Parse a Text String

There are a variety of functions that can be used to parse text strings. This section illustrates the @RightBack, @LeftBack, and @Word functions to retrieve a subset of text from a text string.

How It Works

The following describes a few of the Formula Language functions that can be used to parse text strings.

@Rightback Returns the right-most characters from a string based on a specified delimiter or starting character position. The delimiter could be a single character, such as a comma, or several characters, such as "Record=".

@Leftback Returns the left-most characters from a string based on a specified delimiter or starting character position.

@Word Returns a specific word from a text string based on a specified delimiter and word to return.

ImplementationExample 1

The following illustrates the @Rightback command (see Figure 14.16).

myString := "Mark Elliott"; myResult := @RightBack(myString; " "); @Prompt([Ok]; "RightBack with space delimiter"; "Initial string: " + myString + @NewLine + "Result string: " + myResult)

Figure 14.16. Example of the @Rightback function

 

ImplementationExample 2

The following illustrates the @Leftback command (see Figure 14.17).

myString := "Mark Elliott"; myResult := @LeftBack(myString; " "); @Prompt([Ok]; "LeftBack with space delimiter"; "Initial string: " + myString + @NewLine + "Result string: " + myResult)

Figure 14.17. Example of the @Leftback function

 

ImplementationExample 3

The following illustrates the @Word command (see Figure 14.18).

myString := "Mark Elliott"; word1 := @Word(myString; " "; 1); word2 := @Word(myString; " "; 2); @Prompt([Ok]; "Word using a space delimiter"; "Initial string: " + myString + @NewLine + "Word 1: " + word1 + @NewLine + "Word 2: " + word2)

Figure 14.18. Example of the @Word function

Категории