strval

Find the numeric value of a string.

Description

strval( const string[], index=0, limit=15 )

strval will evaluate all digits starting at the index position until it encounters a non-digit or evaluated limit characters whichever comes first.

Parameters

string The buffer to be evaluated
index The offset in the buffer to start looking for a number.
limit The max number of digits to evaluate, starting after index.

Return value

The value in the string.
Returns 0 if the string starting at the index did not start with a valid number.

Example usage

    new x;
    new s{20} = "Cat47";
 
    x = strval(s, 3); 
 
    // x is now 47

NOTE: The limit parameter requires firmware 24020101 or newer.