balance ( theText ; openbracket ; closebracket ; instance )
Get text to length that balances open/close markers
Average rating: 4.4 (42 votes) Log in to vote
Bruce Robertson - Show more from this author |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Given text such as JSON or HTML or XML formatted text, look for specified instance of openbracket, then look for instance of closebracket satisfying condition that count of openbracket = count of closebracket.
Returns all text up to and including identified closebracket
Can be used with single or multi character values:
{}; (); [];
Recursive function.
Edited 12/17/2014
Comments
Christopher Kuhn, Temecula Jul 11, 2014 |
||
Hi, I found that if the openbracket and closebracket are the same character then the function returns a single character...the bracket. I changed the function such that the location of the close bracket is AFTER the location of the openbracket.... original: p2 = Position ( theText; closebracket ; 1; $instance ) ; change: p2 = Position ( theText; closebracket ; p1+1 ; $instance ) ; Now, i can find quoted strings with the function :) |
||
Bruce Robertson Dec 17, 2014 |
||
Christopher - thanks for the suggested mod! Incorporated in revised version. | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.