[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Double single quote
- Subject: Re: Double single quote
- From: Cherno Jagne <ITSCJ@QE2-HSC.NS.CA>
- Date: Tue, 26 Oct 1999 18:13:07 -0300
Hi Bao,
It seems like your problem is in the usage of translate, as opposed to
embedding single quotes inside strings.
To illustrate,
translate('ABC.DEF','.','..')
still returns 'ABC.DEF'. Read up a little on the translate command and
you'll see what I'm saying.
If you have Oracle, you can do
begin-select
replace($string,'''','''''') &new_str
from dual
end-select
and that will give the result you want.
Otherwise you can use various functions in SQR to achieve what you want,
eg:
let $new_str = substr($string,1,instr($string,'''',1)) ||
substr($string,instr($string,'''',1),length($string) -
instr($string,'''',1) + 1)
Needless to say, you can do the above in a number of different ways but
being a C fan, I'd go with
the above.
Hope that helped,
Cherno.
>>> Bao Chau Ngo <bngo@ALDOGROUP.COM> 10/25 11:43 AM >>>
Hi Gina.
I problem is $string contain (winner's choice). I want to replace
the
single
quote to double single quote. Here what I want to do
translate($string,'''','''''''') ! the result should be (winner''s
choice)
Thank in advance.
In SQR to embed a quote inside a literal string you must type the quote
twice inside the literal or use a variable containing a quote to build
your string:
Here are some choices:
move 'winner''s choice' to $string ! resulting string is winner's
choice
or
let $quote = chr(39) ! or let $quote = '''' (4 single quotes)
let $string = 'winner' || $quote || 's choice'
SQR has a similar requirement for exclamation points:
move 'winner''s choice!!' to $string ! resulting string is winner's
choice! !
Hope this helps.
Gina Bencke
Bencke Consulting Corporation
gina@bencke.com
-----Original Message-----
From: Bao Chau Ngo [mailto:bngo@ALDOGROUP.COM]
Sent: Monday, October 25, 1999 9:52 AM
To: Multiple recipients of list SQR-USERS
Subject: Double single quote
Hi every Body
I have a string = winner's choice I want to put double single
quote
in this. How I do that.
Thank in advance.