GetWord

Description

Extracts a word of text from the input. This function is a smart way to locate and parse words just like double clicking highlights a word.

Syntax

target.strlib.GetWord( input, pos, to_the_right )

input - The input string.

pos - The position from which GetWord will search to the left or right of. (default 0)

to_the_right (Boolean input) - the function returns the next word to the right when true or to the left when false (default is true)

Return value

This function returns a string.

Sample

'---------- Start ----------

Function Start

Dim str, str2, str3

str = "Extract Word"

str2 = target.strlib.GetWord( str, 8, false )

str3 = target.strlib.GetWord( str, 8 )

trg.Message( str2&"|"&str3 )

End Function

In this case the first instance of GetWord (str2) takes the word to the left of position 8 because the third parameter (to_the_right) is false, Then the second instance (str3) takes the work to the right of position 8 becuase if the third parameter isn't there, the default is true. 

See also

Platform Objects and Methods

Trim

Split

Mid