[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Clarification - string manipulation
If I understand the problem correctly, this appears to work:
let $new_record = replace($record,',',''',''')
let $new_record = '''' || $new_record || ''''
The replace puts the commas in the body of the record
( 1','2W2','3W3','5W2 ) and the last line adds them to the beginning and
end ( '1','2W2','3W3','5W2' ) .
Hope this helps.
Amy Emge
Applications Analyst
Miami University
At 02:23 PM 2/5/2002 -0800, you wrote:
>Using SQW 4.3.4
>
>The records I'm reading are variable in length and I'm pulling them
>from a run control record. They take the form of,
>
>1st record = 1,2W2,3W3,5W2
>2nd record = 1,3W1,3W2,3W3,5W1
>3rd record = 2W2,3W3
>
>I'm looking for a clever way to change the records to take the form
>of, for example, '1','2W2','3W3','5W2' without writing a WHILE loop.
>
>I've tried, LET $new = translate($record,',',''','''). This changes the
>commas to a single tick, so I get 1'3w1'3w2'3w3'5w1.
>
>I've tried LET $new = translate($s,',','","'), and I get
>1"3w1"3w2"3w3"5w1.
>
>So it appears that TRANSLATE substitutes 1 character for 1 character
>and cannot substitute 1 character for many.
>
>Still looking for a clever way to do it within SQR and without writing
>a WHILE loop.
>Thanks to all who have responded. Jim
>
>PS I'm using Oracle and may resort to an earlier suggestion,
>select replace('1,2,3',',',''',''') from dual.
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Send FREE Valentine eCards with Yahoo! Greetings!
>http://greetings.yahoo.com