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
Virtual Vermont http://www.virtualvermont.com/FMP/ |
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).
Comments
Peter Vinogradov 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) ] ; Pre & If (not IsEmpty (Style) ; TextStyleAdd ( Phrase ; Style ) ; Phrase ) & If ( More ; hlSection ( post ; Values ; Red ; Green ; Blue ; Style ) ; Post ) ) ------------- |
||
gopal patel, Dr Patels Clinic Jul 24, 2021 |
||
@ Peter Vinogradov for the recursive version I tried hlSection ( text ;"¶" ; 255 ; 21 ; 21 ; Italic ) but the section has multiple but it only does for the 1st any thing I am missing? |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.