Re: Is there a way of reading a sequence from a variable?
- Posted by jimcbrown (admin) Apr 17, 2012
- 1259 views
bill said...
What I want to read is any Eu object - eg "\"Hello\"".
That is given something like:
"\"alpha\" = 3.456"
I can read out "alpha",
drop the white space
see I've got '=',
drop it and any white space following,
then read out the value (which culd be any Eu object),
checking at the end I've consumed the whole string.
Sort of get() for strings, or
Poor man's parsing.
Thanks
You can do that with value().
Something like this:
integer pos = 1 sequence s sequence objects = {} while pos <= length("\"alpha\" = 3.456") do s = value("\"alpha\" = 3.456", pos, GET_LONG_ANSWER) objects &= s[2] pos += s[3] end while