I need to extract the numbers of a string (the name of a method-calling process). The string will typically be "SP12" or "SingleProces52" or "XXXXX###", being X leters and # numbers.
I need to extract only the numbers from the string. Length of the string and position of the first numer will always be variable.
Is there any way of doing this?
Solved! Go to Solution.
For example this way:
is n : integer; do local s : string := "SingleProc123"; for local i := 1 to strlen(s) loop local a : integer := ascii(s, i); if a >= ascii("0") and a <= ascii("9") then n := str_to_num(copy(s, i, 9999)); exitloop; end; next; print n; -- prints 123 end;