Sfairadora

  • Reference Guide

skip_identifier

skip_identifier(str, n)
Returns the index of the first character in the string str after the position n (including the character at the index n) that is not a valid character of an identifier. In other words, the function skips the identified at the position n. If there is no identifier at the position n, the index n is returned. The index of the first character in the string is 0. If n is negative, the value 0 is usded.
The parameter str can be a String, Text or Rich_string. The parameter n and the return value are of the type Int.
The functions whose name begins with skip_… serve to analyze a string. The best way to use them is to create a variable containing an index (pointer) of the current position within the string. This variable is passed to the appropriate skip­_… function as the parameter determining the place, where to search the string from. The resulting value (the new pointer) is then assigned back to the variable.
Example:
var Int pos1 = skip_identifier(str, pos);
if(pos1==pos)
error("expecting an identifier");
var String identifier = substr(str, pos, pos1-pos)
pos = pos1;

See Also