Function overview
Prototype
TextHighlightWithStyles (
_text; _searchString; _styles )
Parameters
_text the text to display
_searchString the string to highlight
_styles styles separated by +. See documentation.
Description
Tags:
Text Parsing Text Interface Format
g :
TextHighlightWithStyles ( "Kennedy was assassinated, like his brother KENNEDY" ; "Kennedy" ; bold+italic )
Will highlight both occurrences of 'Kennedy' by adding bold and italic syles.
Not Case Sensitive
Recursive
This function is handy to display the result of Quickfind, especially with HighlightYellow.
For a list of available styles, check this page :
http://www.filemaker.com/11help/html/func_ref3.33.99.html#1032591
Examples
Sample input
TextHighlightWithStyles ( "Kennedy was assassinated, like his brother KENNEDY" ; "Kennedy" ; bold+italic )
Sample output
Will highlight both occurrences of 'Kennedy' by adding bold and italic sytles.
Function code
/*TextHighlightWithStyles ( _text ; _searchString ; _styles )
by Fabrice Nordmann, 1-more-thing
v.1.1 Sept 2010
v.1 March 2010
Highlights a string found in a text by adding one or more styles
eg :
TextHighlightWithStyles ( "Kennedy was assassinated, like his brother KENNEDY" ; "Kennedy" ; bold+italic )
Will highlight both occurrences of 'Kennedy' by adding bold and italic styles.
Not Case Sensitive
Recursive
This function is handy to display the result of Quickfind, especially with HighlightYellow.
For a list of available styles, check this page :
http://www.filemaker.com/11help/html/func_ref3.33.99.html#1032591
*/
Let ([
_pos = Position ( _text ; _searchString ; 1 ; 1 ) ;
_len = Length ( _searchString )
];
Case ( PatternCount ( _text ; _searchString ) ;
Left ( _text ; _pos -1 ) & TextStyleAdd ( Middle ( _text ; _pos ; _len ) ; _styles ) & TextHighlightWithStyles ( Right ( _text ; Length ( _text ) - _pos - _len + 1 ) ; _searchString ; _styles ) ;
_text
)
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/268
Prototype: TextHighlightWithStyles( _text; _searchString; _styles )
Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
Last updated: 15 January 2011
Version: 1.2
*/
// ===================================
/*TextHighlightWithStyles ( _text ; _searchString ; _styles )__LITBR____LITBR__by Fabrice Nordmann, 1-more-thing__LITBR__v.1.1 Sept 2010__LITBR__v.1 March 2010__LITBR____LITBR____LITBR__Highlights a string found in a text by adding one or more styles__LITBR____LITBR__eg :__LITBR__TextHighlightWithStyles ( "Kennedy was assassinated, like his brother KENNEDY" ; "Kennedy" ; bold+italic )__LITBR____LITBR__Will highlight both occurrences of 'Kennedy' by adding bold and italic styles.__LITBR____LITBR__Not Case Sensitive__LITBR__Recursive__LITBR____LITBR____LITBR__This function is handy to display the result of Quickfind, especially with HighlightYellow.__LITBR____LITBR__For a list of available styles, check this page :__LITBR__http://www.filemaker.com/11help/html/func_ref3.33.99.html#1032591__LITBR____LITBR__*/__LITBR____LITBR__Let ([__LITBR__ _pos = Position ( _text ; _searchString ; 1 ; 1 ) ;__LITBR__ _len = Length ( _searchString ) __LITBR__];__LITBR__ Case ( PatternCount ( _text ; _searchString ) ;__LITBR__ Left ( _text ; _pos -1 ) & TextStyleAdd ( Middle ( _text ; _pos ; _len ) ; _styles ) & TextHighlightWithStyles ( Right ( _text ; Length ( _text ) - _pos - _len + 1 ) ; _searchString ; _styles ) ;__LITBR__ _text__LITBR__ )__LITBR__)__LITBR____LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/268__LITBR____LITBR__ Prototype: TextHighlightWithStyles( _text; _searchString; _styles )__LITBR__ Function Author: Fabrice (http://www.fmfunctions.com/mid/37)__LITBR__ Last updated: 15 January 2011__LITBR__ Version: 1.2__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
07 September 2010
07 September 2010
sorry, was a translation error. Now fixed (Fin is the French translation of Right)
01 December 2010