hlSection ( theText ; Values ; Red ; Green ; Blue ; Style )
Rate this function: Average rating: 3.9 (12 votes) Discuss this Custom Function
Matt Wills, Virtual Vermont
http://www.virtualvermont.com/FMP/
Highlight everything between specified words with Text Color and Styles
Sample Input:
<font color="Gray">Where theText is:</font>
When, in the Course of human Events, it becomes necessary for one People to dissolve the Political bands, which have connected them with another...
<font color="Gray">and you want to make everything between "dissolve" and "bands" appear bolded and underlined in red, the CF would be:</font>
hlSection ( theText ; "dissolve¶bands" ; 255 ; 0 ; 0 ; Bold+Underline ) |
|
Sample Output:
| When, in the Course of human Events, it becomes necessary for one People to <font color="Red"><B><U>dissolve the Political bands</U></B></font>, which have connected them with another..." |
|
Description:
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).
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:
|
Newest Custom Functions:
| 1. |
CountWordOccurrences ( text ; searchWord ) |
| |
(Tue, Feb 07, 11:15am) |
| 2. |
indonesian_date(date) |
| |
(Mon, Feb 06, 7:14pm) |
| 3. |
phpArrayValue ( array ; key ; pos ) |
| |
(Fri, Jan 27, 1:49pm) |
| 4. |
solfm_timeToMinutes (theTime;roundSec) |
| |
(Fri, Jan 20, 6:26am) |
| 5. |
filterLines(filterField;filterValue;Result) |
| |
(Sat, Jan 14, 2:20pm) |
| 6. |
getMaxValue ( theList ) |
| |
(Thu, Jan 12, 1:06pm) |
| 7. |
MiddleWordsIncPunct ( text ; startingWord ; numberOfWords ) |
| |
(Sat, Jan 07, 9:16am) |
| 8. |
WindowInfo |
| |
(Fri, Jan 06, 12:39pm) |
 |
|
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
)
)
-------------
Peter Vinogradov, Hyde Park, NY
February 14, 2011 7:24am