%strlen macro is
%assign macro in that it creates (or redefines) a
numeric value to a macro. The difference is that with
%strlen, the numeric value is the length of a string. An example of the
use of this would be:
%strlen charcnt 'my string'
In this example,
charcnt would receive the value 8, just
as if an
%assign had been used. In this example,
'my string' was a literal string but it could also have been
a single-line macro that expands to a string, as in the following example:
%define sometext 'my string' %strlen charcnt sometext
As in the first case, this would result in
assigned the value of 8.
%substr mychar 'xyz' 1 ; equivalent to %define mychar 'x' %substr mychar 'xyz' 2 ; equivalent to %define mychar 'y' %substr mychar 'xyz' 3 ; equivalent to %define mychar 'z'
In this example, mychar gets the value of
'y'. As with
%strlen (see Section 4.2.1), the first parameter is the
single-line macro to be created and the second is the string. The third parameter
specifies which character is to be selected. Note that the first index is 1, not 0 and
the last index is equal to the value that
assign given the same string. Index values out of range result in an empty string.