May 21, 2007, 08:29 PM
Code Diggertokenizing a string containing single quotes and commas
Hi,
I have a string with values like
'abc', 'xyz', 'lmn'
i.e. values in single quotes and comma separated. This complete string is read in an ampersand variable.
I have to convert this string to following string
'''abc'', ''xyz'', ''lmn'''
Any function I use takes 'abc', 'xyz', 'lmn' as 3 different parameters instead of a single parameter. What function should I use to get my final string.
Thanks,
CD
May 22, 2007, 02:29 AM
Alan BWell you can't have tried very hard CD, STRREP or CTRAN work fine:
-SET &dqString=STRREP(&sqString.LENGTH,&sqString,1,'''',1,'"',&sqString.LENGTH,'A&sqString.LENGTH');
-SET &dqString=CTRAN(&sqString.LENGTH,&sqString,39,34,'A&sqString.LENGTH');
Please confirm if this works for you. You haven't acknowledged if the suggestions provided by members for you provide a working solution in many of your last topics.
May 22, 2007, 09:40 AM
Code DiggerThanks Alan for all your solutions and suggestions.
STRREP is what I was looking for. Since directly using CTRAN or POSIT was giving me problems.