VERIFYR

The VERIFYR function performs the same operation as the VERIFY built-in function except that the verification is done from right to left.

Another difference is that the default value for n is LENGTH(x).

Read syntax diagramSkip visual syntax diagram
>>-VERIFYR(x,y-+----+-)----------------------------------------><
               '-,n-'     

Unless 0 ≤ n ≤ LENGTH(x), the STRINGRANGE condition, if enabled, is raised. If n = 0, the result is zero.

The BIFPREC compiler option determines the precision of the result returned.

VERIFYR will perform best when the second and third arguments are either literals, named constants declared with the VALUE attribute, or restricted expressions.

For argument descriptions, see VERIFY.

Example

  X = 'a  b  ';         /* Two blanks in each space */
  Y = ' ';              /* One blank                */
  N = length(X);        /* N = 6                 */
  I = verifyr(X,Y,N);   /* I = 4                 */

  do while (I > 0);
    display ( 'Nonblank at position ' ∥ trim(I) );
    N = I - 1;
    I = verifyr(X,Y,N);
  end;

After the first pass through the do-loop, N=3 and VERIFYR(X,Y,N) returns 1. After the second pass, N=0, VERIFYR(X,Y,N) returns 0, and the loop ends. For another example, see SEARCHR.






Published: 23 December 2018