Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

Text Operations

Contains()

This function checks whether a string is contained in another string.

Return type: Boolean

Parameter

Data Type

Description

1

Text

String to be searched

2

Text

String to be searched for

Examples

Contains("ABCDEF", "cd") returns TRUE.

CutLeft(), CutRight()

These functions trims a certain number of characters from the left or right side of a string and return the modified value.

Return type: text

Parameter

Data Type

Description

1

Text

String to be truncated

2

Number

Number of characters to be trimmed

Examples

CutLeft("ABCDEF", 3) returns "DEF".

CutLeft("ABCDEF", 10) returns "".

FillLeft(), FillRight()

These functions fill a string with a fill character up to a specified length on the left side or the right side, and return the modified string.

Return type: text

Parameter

Data Type

Description

1*

Text

String to be filled

2*

Number

New length of the string

3

Text

Single filler character

Default value: blank space

Examples

FillLeft("123", 5, "0") returns "00123".

GetFilePart()

This function returns a specific part of a string representing a file path.

In principle, this may also be a folder path, in which case the name of the lowest folder is treated like a file name.

Return type: text

Parameter

Data Type

Description

1

Text

File path

2

Text

Part of the file path that will be extracted:

  • Folder: complete folder path of the file without / character ending the string

  • FileName: full file name (default value)

  • FileBaseName: base file name without extension

  • FileExt: file extension without a separator

3

Number

If the search is not to cover the full folder path (Folder), but only the name of a directory at a certain level, specify the number of this level here.

The count starts at 1. The drive or share name does not count.

Examples

GetFilePart("c:/temp/files/test.txt", "FileBaseName") returns "test".

GetFilePart("c:/temp/files/test.txt", "Folder", 2) returns "files".

GetFilePart("c:/temp/files/test.txt", "Folder", 3) returns "files" (alternatively the folder of the lowest level, because the third level does not exist).

GetRandomText()

This function returns a randomly generated string.

Return type: text

Parameter

Data Type

Description

1

Number

Minimum length of the string to be generated

Default value: 1

2

Number

Maximum length of the string to be generated

Default value: 100

3

Text

String of the characters to be used

Characters are selected at random from the string.

Default value: abcdefghijklmnopqrstuvwxyz-

Examples

GetRandomText(5, 10, "abc") returns a string that is 5 to 10 characters long (e.g., "bccacaa").

IsText()

This function checks whether a value is of the data type "Text."

Return type: Boolean

Parameter

Data Type

Description

1*

(variable)

Value to be checked

Examples

IsText("abc") returns TRUE.

IsText(TRUE) returns FALSE.

KeepChars()

This function deletes from a string all characters that are not to be retained explicitly, after which it returns the modified string.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Text

List of characters to be retained, i.e., not to be deleted

The specification is made in the form of a contiguous string of these characters, in which ranges of the form 0-9 or A-Z can also be defined.

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

KeepChars("A B-c", "ABC", FALSE) returns "AB".

LastPos()

This function returns the start position of the last occurrence of a search string within a string.

Counting starts at 1. If a search string is not found, the result will be 0.

Return type: number

Parameter

Data Type

Description

1

Text

String to be searched

2*

Text

Search string

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

LastPos("ABC ABC abc", "ABC", FALSE) returns 5.

Left(), Right()

These functions read a certain number of characters from a string on the left or the right side (i.e., at the beginning or the end).

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Number

Number of characters to be extracted

Default value: 1

Examples

Left("ABCDEF", 3) returns "ABC".

Left("ABCDEF", 10) returns "ABCDEF".

Length()

This function returns the length of a string (i.e., the number of characters).

Return type: number

Parameter

Data Type

Description

1

Text

String

Examples

Length("ABC") returns 3.

Mid()

This function reads a specified number of characters from a string starting at any position.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Number

Start position (i.e., the number of the character)

Counting starts at 1.

Default value: 1

3

Number

Number of characters to be extracted

Default value: 1

Examples

Mid("ABCDEF", 3) returns "C".

Mid("ABCDEF", 3, 2) returns "CD".

Mid("ABCDEF", 3, 10) returns "CDEF".

Pos()

This function returns the start position of the first occurrence of a search string within a string.

Counting starts at 1. If a search string is not found, the result will be 0.

Return type: number

Parameter

Data Type

Description

1

Text

String to be searched

2*

Text

Search string

3

Number

Character position from which the search is started

Default value: 1

4

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

Pos("ABC abc ABC", "ABC", 2, FALSE) returns 9.

RegExIsMatch()

This function checks a string for a match with a regular expression.

Return type: Boolean

Parameter

Data Type

Description

1

Text

String to be checked

2*

Text

Regular expression

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RegExIsMatch("ABC", "^A.*") returns TRUE.

RegExMatch(), RegExLastMatch()

These functions extract a string's first and the last part that matches a regular expression.

The RegExMatch() function evaluates only the first match. If the regular expression does not contain any groupings (in round brackets), only a single text value will be returned. If no match is found, an empty text value will be returned. Otherwise, the result consists of an array with the text values across all groups.

Parameter

Data Type

Description

1

Text

String to which the regular expression is applied

2*

Text

Regular expression

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RegExMatch("ABCabc", "A..") returns "ABC".

RegExLastMatch("ABCabc", "A..") returns "abc".

RegExMatch("ABCDEF", "(A..)(D..)") returns ["ABC", "DEF"].

RegExMatch("ABCDEF", "(U..)(X..)") returns "".

RegExMatches()

This function returns one or more parts of a string which match a regular expression.

An array is always returned regardless of the number of hits. If the expression contains groupings (in round brackets), the result values of all groups across all hits are written to the array.

Parameter

Data Type

Description

1

Text

String to which the regular expression is applied

2*

Text

Regular expression

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RegExMatches("ABC DEF ghi", "[A-Z]+", FALSE) returns ["ABC", "DEF"].

RegExMatches("ABC1 def2", "([A-Z]+)(\d+)") returns ["ABC", "1", "def", "2"].

RegExMatchPos(), RegExLastMatchPos()

These functions return the start position of the first or the last occurrence of a string segment corresponding to a regular expression.

Counting starts at 1. If no match is found, the result is 0. If the regular expression contains groupings, only the position of the first group is determined.

Return type: number

Parameter

Data Type

Description

1

Text

String to which the regular expression is applied

2*

Text

Regular expression

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RegExMatchPos("ABCabc", "c") returns 3.

RegExLastMatchPos("ABCabc", "c") returns 6.

RegExReplace()

This function replaces in a string all occurrences corresponding to a regular expression.

Return type: text

Parameter

Data Type

Description

1

Text

String to which the replacement is applied

2*

Text

Regular expression

3

Text

Replacement value

If parts in the string are to be removed instead of replaced, an empty value can also be specified here.

4

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RegExReplace("A B-c", "[^A-Z]", "_") returns "A_B_c".

RegExReplace("A B-c", "[^A-Z]", "", FALSE) returns "AB".

RemoveChars()

This function deletes from a string all occurrences of certain characters, and returns the modified string.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Text

List of characters to be deleted

The specification is made in the form of a contiguous string of these characters, in which ranges of the form 0-9 or A-Z can also be defined.

3

Bool

Boolean value determining whether case will be ignored during comparison

Default value: TRUE

Examples

RemoveChars("A1 B2 C3", " 0-2") returns "ABC3".

Replace()

Within a string, this function removes all occurrences of a search string, replacing them with a different string, and returning the modified string.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Text

Search string to be replaced

3

Text

Search string to be used as the replacement

Default value: empty string

Examples

Replace("A B C", " ", "_") returns "A_B_C".

Replace("A-B-C", "-", "") returns "ABC".

ToLower(), ToUpper()

These functions convert a string to lowercase or uppercase, and return the modified value.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

Examples

ToLower("AbC") returns "abc".

ToText()

This function converts a scalar value or an array of arbitrary type into a string (which is delimited) and returns it.

Return type: text

Parameter

Data Type

Description

1

(variable)

Scalar value or array of values

2

Text

Formatting pattern for converting typed values into a string

The same syntax applies as for sending textual values to an output system (see property OutputSystem[].Field[].OutputFormat), e.g., yyyy-MM-dd for a date format and 0.00 for a number format.

3

Text

Delimiter used to concatenate multiple values into the overall string

Default value: | (pipe character)

Examples

ToText(2025-12-31, "dd.MM.yyyy") returns "31.12.2025".

ToText([1.2, 3.4], "0.00", " ") returns "1.20 3.40".

ToText([1, 2]) returns "1|2".

Trim(), TrimLeft(), TrimRight()

These functions truncate a string either on both sides, on the left side (at the beginning), or on the right side (at the end). All consecutive occurrences of a given character are removed, and the modified string is returned.

Return type: text

Parameter

Data Type

Description

1

Text

Underlying string

2

Text

Characters to be trimmed

Default value: blank space

Examples

Trim(" ABC ") returns "ABC".

TrimLeft("__ABC__", "_") returns "ABC__".