There are two forms:
Performs a case sensitive comparison between two strings and returns a Boolean.
s1, s2 |
The strings that are compared. |
r |
A Boolean. True if they match, else false. > print(StrCmp(‘abc’, ‘abc’)) true |
r = StrCmp(s, t)
Performs a case sensitive comparison between a string and a table of strings. It searches the table and returns a vector of indices in the table where matches were found. The search supports partial match via wildcard characters. If no match is found an empty matrix is returned.
s |
The string to search in the table. |
t |
The table of strings. |
r |
A matrix of the indices in the table where matches are found. > t= {‘abc’, ‘xyz’, ‘abc’}; > r = StrCmp(‘xyz’, t); print(r) [Matrix] 1 x 1 2 > r = StrCmp(‘ab*’, t); print(r) // partial match [Matrix] 1 x 2 1 3 |