arunkw
23rd August 2002, 14:13
Hi,
given below code takes seperates out input.string into temp.string and next.string as soon as it find as seperator sign "<" this code works fine

if pos(input.string,"<") <> 0 then
string.scan(input.string,"%s<%s",temp.string,next.string)
endif

but how do i seperate out a string which has escape sequence "\n" in it i.e abc\ndef\n
the above given code dosen't work for this
ie when i do

if pos(input.string,"\n") <> 0 then
string.scan(input.string,"%s\n%s",temp.string,next.string)
endif

this dosen't go inside if statements .....can somebody suggest me how to acheive this feat

FransG
23rd August 2002, 14:53
position = pos(input.string, "\n")
if position <> 0 then
temp.string = input.string(1;position-1)
next.string = input.string(position+2;
(len(input.string)-position+2))
endif

OmeLuuk
23rd August 2002, 14:57
I think you might need to use the translation of \n the way it is stored in the string itself. It may be something like chr$(13) or chr$(10).

FransG
23rd August 2002, 14:58
You were almost there. Try the following:


if pos(input.string,"\n") <> 0 then
string.scan(input.string,"%s\\n%s",temp.string,next.string)
endif