Product Site

5.1.7.98. verify

Returns a number that, by default, indicates whether the receiving string is composed only of characters from reference. It returns 0 if all characters in the receiving string are in reference or returns the position of the first character in the receiving string not in reference.

The option can be either Nomatch (the default) or Match. (You need to specify only the first capitalized and highlighted letter; all characters following the first character are ignored)

If you specify Match, the method returns the position of the first character in the receiving string that is in reference, or returns 0 if none of the characters are found.

The default for start is 1. Thus, the search starts at the first character of the receiving string. You can override this by specifying a different start point, which must be a positive whole number.

The default for length is the length of the string from start to the end of the string. Thus, the search proceeds to the end of the receiving string. You can override this by specifying a different length, which must be a non-negative whole number.

If the receiving string is null, the method returns 0, regardless of the value of the option. Similarly, if start is greater than receiving_string~length, the method returns 0. If reference is null, the method returns 0 if you specify Match. Otherwise, the method returns the start value.
Example 5.133. String class — verify method
"123"~verify("1234567890")             -->    0
"1Z3"~verify("1234567890")             -->    2
"AB4T"~verify("1234567890")            -->    1
"AB4T"~verify("1234567890","M")        -->    3
"AB4T"~verify("1234567890","N")        -->    1
"1P3Q4"~verify("1234567890", ,3)       -->    4
"123"~verify("",N,2)                   -->    2
"ABCDE"~verify("", ,3)                 -->    3
"AB3CD5"~verify("1234567890","M",4)    -->    6
"ABCDEF"~verify("ABC","N",2,3)         -->    4
"ABCDEF"~verify("ADEF","M",2,3)        -->    4