Match First String Function
- Updated2025-07-30
- 2 minute(s) read
Compares each prefix string in string array to the beginning of string until it encounters a match. This function returns the original input string with the matching prefix string removed.

Inputs/Outputs
string
—
string specifies the string to match to the prefixes in string array. The default is an empty string.
string array
—
string array specifies the array of strings that you want to match with string. If the function encounters an empty string in string array, the function considers that string a match.
output string
—
output string returns the original string with the matching prefix removed. If the beginning of string does not match any string in string array, output string returns the original string.
index
—
index returns the numeric index of the matching prefix in string array. If the beginning of string does not match any string in string array, index is –1. |
This function compares each string in string array to string in the order in which the elements are indexed. This function always searches from the beginning of string and matches the first string prefix that appears at the beginning of string. For example, this function matches Error 1 in the string Error 16: error occurred if Error 1 comes before Error 16 in string array. However, the function matches Error 16 if Error 16 comes before Error 1 in string array.
string
—
string array
—
output string
—
index
—