
Extraction of a substring

kangaroo
I do now have the following problem extracting data from a file:
Using fread I read a line from an ASCII file into a string varibale. The
string then contains various characters (letters numbers, special
characters) of which only a substring contains the information needed, in
this special case this is the last 6 characters.
the reading part of my procedure looks as follows:
open/R/P=DATA refnum as filename for(i=0;i<17;i+=1) FReadLine refNum, help_str //steps through the lines, information wanted is in line 19(counting from1) endfor FReadLine refNum, help_str //now help_str contains the line cotaining the needed numbers //s.th. like "shajshdja : 84298 / smasjdak :jkahsdf :123456" //"123456" is the substring I want to extract into a new string and its allways at the end of the line close refnum
I can locate the string I am looking for using strsearch. So I know that
in one particular case it starts with the 85th character of the total string
and is 6 characters long.
Can I somehow extract a substring from the read-in string by using its
length and position? I can not use stringbykey or listitem as the sting is
quite unstructured. But is there a possibilty using sscanf?
June 30, 2008 at 01:29 pm - Permalink
did it
July 1, 2008 at 01:21 am - Permalink