Contents | Index | < Browse | Browse >
VERIFY(<string>, <reference>, ['MATCH'], [<startpos>])
returns a number
Checks for the presence in <string> of any characters that appear in
<reference> -- a list of characters which may be entered in any order.
If the 'MATCH' option is omitted, the functions returns 0 when all
characters in <string> are contained in <reference>. Otherwise, the number
returned is the position of the first character in <string> that does not
match a character in <reference>.
The 'M' (match) option will cause the function to return the position of
the first character in <string> that matches a character in <reference>.
It returns 0 if none of the characters in <string> match a character in
<reference>. It can be used to verify that invalid characters are not used
in <string> or to check for the position of the first of a range of
characters.
If <startpos> is specified, the search will begin at that character
position in <string>.
Examples:
say verify('#789-ABD', '1234567890ABCD-#') >>> 0
say verify('#432-cfo', '1234567890ABCD-#') >>> 6
say verify('FileName', ':;*/?`#%', 'm') >>> 0
say verify('File*NAME', ':;*/?`#%', 'm') >>> 5
say verify('File*NAME', ':;*/?`#%', 'm',6) >>> 0
say verify('t:foo/file', ':/', 'm') >>> 2
Also see
NOTE: Checking unique datatypes
Next: Comparison functions | Prev: POS() | Contents: Comparison functions