Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6470 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Name & Parameters: [color:red][big] GetStyledWords ( text ; style ) [/big]

Description: GetStyledWords custom function

revision 1: now finds plain text, too.

Author: Daniele Raybaudi

Format: GetStyledWords ( text ; style )

Parameters:

text - the given text where there are some styled words

style - the style to search for ; if it is empty the function will search for "plain"

Returns all the styled words ( in list view ) within the given text

Sample Input:

I'm going to learn English

GetStyledWords ( text ; "" )

Results:

I'm

to

learn

Sample Input:

I'm going to learn English

GetStyledWords ( text ; "bold" )

Results:

going

English

Recursive: yes

Formula:

/*

GetStyledWords custom function



revision 1: now finds plain text, too.



Author: Daniele Raybaudi



Format: GetStyledWords ( text ; style )



Parameters:

text - the given text where there are some styled words

style - the style to search for ; if it is empty the function will search for "plain"



Returns all the  styled words ( in list view ) within the given text



Example 1)

text = I'm going ( bold ) to learn English ( bold )

GetStyledWords ( text ; "bold" ) returns:

going

English



Example 2)

text = I'm going ( bold ) to learn English ( bold )

GetStyledWords ( text ; "" ) or GetStyledWords ( text ; "plain" ) returns:

I'm

to

learn



*/

Let ( [

style = If ( IsEmpty ( style ) or style = "plain" ; """" ; style ) ;

svg = GetAsSVG ( text ) ;

parseSVG = MiddleValues ( svg ; 2 ; PatternCount ( svg ; "Style#" ) ) ;

nextSVG = RightValues ( svg ; ValueCount ( svg ) - 2 ) ;

line = GetValue ( parseSVG ; 1 );

pos1 = GetAsNumber ( Middle ( line ; Position ( line ; "," ; 1 ; 1 ) + 1 ; Position ( line ; "," ; 1 ; 2 ) - Position ( line ; "," ; 1 ; 1 ) - 1  ) ) ;

pos2 = GetAsNumber ( Middle ( line ; Position ( line ; "," ; 1 ; 2 ) + 1 ; Position ( line ; "<" ; 1 ; 2 ) - Position ( line ; "," ; 1 ; 2 ) - 1  ) ) ;

string = Middle ( text ; pos1 ; pos2 - pos1 + 1 );

adjString = Substitute ( TrimAll ( Substitute ( Middle ( text ; pos1 ; pos2 - pos1 + 1 )  ; ¶ ; " " ) ; 1; 1 ) ; " " ; ¶ ) ;

next = Trim ( Middle ( text ; Length ( string ) + 1 ; Length ( text )  ) )

] ;

Case ( 

PatternCount ( nextSVG ; style ); 

Case(

PatternCount ( line ; style )  ; adjString & ¶ & GetStyledWords ( next ; style );

GetStyledWords ( next ; style )

);

Case(

PatternCount ( line ; style ); adjString ;

""

)

)

) 

Required Functions: None

Author(s): raybaudi

Date: 03/08/07

Credits:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

This topic is 6470 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.