String functions
The following table provides a list of string functions.
Function | Usage |
---|---|
Create text The Create Text function returns a string of text. |
Note: The character sequence is repeated until the
returned string reaches the size that is specified. |
Format date UTC The Format date
UTC function returns the number of milliseconds that passed between
January 1, 1970 and the supplied date and time. This data can be used
for mathematical operations or functions. For example, if a test receives
a message that was published with a timestamp in it, you would have
two dates that are expressed as strings: the one in the message and
the system tag that contains the current. You could run |
Legacy Example: Returns 1230822930000
Notes:
|
Get token The Get Token function extracts a token from a tokenized string. It takes a portion of a larger string as determined by the delimiters in use and a specified index value. |
Examples: Note the following examples: Returns an
empty string, since empty strings are included and the third position (index 2) is null. Returns
"ccc", since empty strings are ignored, meaning that the third position
(index 2) is "ccc". |
Regular expression The Regular Expression function executes a regular expression extraction against a source string. By default, the first group that is returned, however an optional fourth parameter can be used to extract other groups. |
Examples: The simplest case is to see if a pattern exists within the string: Returns
'true'. Returns
'false'. Returns
'll'.ECMAScript Example: If a time field (hh:mm:ss) is extracted from a message and is held in a tag named "timeField", the following function returns the value for the hours as instance 1:
Increasing the instance argument to "2" or "3" provides access to the minute and second values. Example: It is possible to specify multiple sections of text within ( ) brackets. In this case, the function extracts some words from the following tag in an XML document that is specified by %%XML%%: Finds
the first ( ) match, the word that begins with 't'
and returns 'to'. Finds
the second ( ) match and returns 'transformed'.Note: If extractionGroup is
set to zero, the whole string match is returned. Using Modifiers Modifiers can be used in regular expression (for example, to process strings that span multiple lines). Modifiers are placed in front of the regular expression in round brackets, as follows:
Modifiers can be combined in the same brackets by using a single '?', as follows:
The following is a list of commonly used modifiers:
Modifiers can be used anywhere that regular expressions are used in Rational® Integration Tester, for example in tagging operations. For more information, see the Perl regular expression documentation. |