Product SiteDocumentation Site

5.4.15.36. verify


>>-verify(reference-+----------------------------------------------+-)--><
                    +-,--+--------+--+---------------------------+-+
                         +-option-+  +-,--+-------+--+---------+-+
                                          +-start-+  +-,length-+

Returns a number that, by default, indicates whether the receiving buffer is composed only of characters from reference. It returns 0 if all characters in the receiving buffer are in reference or returns the position of the first character in the receiving buffer 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, which can be in uppercase or lowercase.)
If you specify Match, the method returns the position of the first character in the receiving buffer 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 buffer. 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 buffer from start to the end of the buffer. Thus, the search proceeds to the end of the receiving buffer. 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_buffer~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.193. Class MUTABLEBUFFER - verify method

.mutablebuffer~new('123')~verify('1234567890')             ->    0
.mutablebuffer~new('1Z3')~verify('1234567890')             ->    2
.mutablebuffer~new('AB4T')~verify('1234567890')            ->    1
.mutablebuffer~new('AB4T')~verify('1234567890','M')        ->    3
.mutablebuffer~new('AB4T')~verify('1234567890','N')        ->    1
.mutablebuffer~new('1P3Q4')~verify('1234567890', ,3)       ->    4
.mutablebuffer~new('123')~verify("",N,2)                   ->    2
.mutablebuffer~new('ABCDE')~verify("", ,3)                 ->    3
.mutablebuffer~new('AB3CD5')~verify('1234567890','M',4)    ->    6
.mutablebuffer~new('ABCDEF')~verify('ABC',"N",2,3)         ->    4
.mutablebuffer~new('ABCDEF')~verify('ADEF',"M",2,3)        ->    4