Focal Point
tokenizing a string containing single quotes and commas

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4321069822

May 21, 2007, 08:29 PM
Code Digger
tokenizing 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 B
Well 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.


Alan.
WF 7.705/8.007
May 22, 2007, 09:40 AM
Code Digger
Thanks Alan for all your solutions and suggestions.
STRREP is what I was looking for. Since directly using CTRAN or POSIT was giving me problems.