Problem with Left, Right, substring functions and quotes
Posted: Tue May 31, 2005 11:23 am
I've tried the following in a Server routine intended for use in a PX sequence:
Now when I run this code, string V = ABCD" as expected, but string U = AB. Not only is the trailing double quote trimmed from U, but also the C and D. The same behavior is presented when Left() and Right() syntax is used.
(Note that the correct result can be obtained in this case by simply setting U = S[2,Len(S)-2] but keep in mind that's just a solution to this specific instance of a more general problem - how to manipulate strings with quotes in and around them.)
Has anyone encountered this problem with quotes in strings before? If so, how did you work around it?
TIA
tpb
Code: Select all
S = '"ABCD"' ; * That's '-"-ABCD-"-'
T = S[Len(S)-1] ; * T = ABCD" at this point
U = T[1,Len(T)-1] ; * U should = ABCD
V = T[1,Len(T)] ; * V should = ABCD"
(Note that the correct result can be obtained in this case by simply setting U = S[2,Len(S)-2] but keep in mind that's just a solution to this specific instance of a more general problem - how to manipulate strings with quotes in and around them.)
Has anyone encountered this problem with quotes in strings before? If so, how did you work around it?
TIA
tpb