hlSection ( theText ; Values ; Red ; Green ; Blue ; Style )
Highlight everything between specified words with Text Color and Styles
Average rating: 4.2 (31 votes) Log in to vote
Matt Wills - Show more from this author
When, in the Course of human Events, it becomes necessary for one People to dissolve the Political bands, which have connected them with another...
and you want to make everything between "dissolve" and "bands" appear bolded and underlined in red, the CF would be:
hlSection ( theText ; "dissolve¶bands" ; 255 ; 0 ; 0 ; Bold+Underline )
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Displays everything between two given words in a specified color and styles.
The words in the Values parameter are separated by a pilcrow (as would be values in a list).
Feb 14, 2011
|Useful, thank you. I've created a recursive version that I'm using as a primitive color-coder for some XML:
/* hlSection ( theText ; Values ; Red ; Green ; Blue ; Style ) */
Let ( [
StartWord = GetValue ( Values ; 1 ) ;
Start = Position ( theText ; StartWord ; 1 ; 1 ) ;
FinishWord = GetValue ( Values ; 2 ) ;
Finish = Position ( theText ; FinishWord ; Start ; 1 ) + Length ( FinishWord ) ;
Pre = Left ( theText ; Start -1 ) ;
Phrase = TextColor ( Middle ( theText ; Start ; Finish - Start ) ; RGB ( Red ; Green ; Blue ) ) ;
Post = Right ( theText ; Length ( theText ) - Finish + 1);
More = PatternCount ( Filter ( Post ; StartWord & FinishWord) ; StartWord & FinishWord)
If (not IsEmpty (Style) ; TextStyleAdd ( Phrase ; Style ) ; Phrase ) &
If ( More ; hlSection ( post ; Values ; Red ; Green ; Blue ; Style ) ;
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.