R>sel * fro sometable
 PhNo
 ------------- 
 12-34567
 123-456

R>Upd Sometable set PhNo = ((Sget(PhNo,((sloc(PhNo,'-')) - 1), 1)) +
(Sget(PhNo,((Slen(PhNo))-(sloc(PhNo,'-'))),((sloc(PhNo,'-'))+ 1)))) where PhNo cont '-'
 Columns have been updated in 2 row(s) in SomeTable


R>sel * fro sometable
 PhNo
 ------------- 
 1234567
 123456



----- Original Message ----- 
From: "JEAN-JACQUES LAUBLE" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 20, 2003 12:17 PM
Subject: [RBASE-L] - Re: SRPL


> Hi Troy
>
> I tried the last solution from Mike but it did not work.
> It must be a good solution but is is a bit tricky.
> I have found another way that works with any number of dashes even if they
> are at the beginning or at the end of the telephone number. Il is easy to
> understand but needs a while loop.
> the code is:
>
> drop table twork
> *(twork is a working table)
> create table twork (tt1 text,tt2 text,tt3 text,tt4 text)
> *( you can put as many tt depending on the number of dashes)
> set delimit=-
> *( setting the delimit to - will permit to use the load function and
> separate the number from the dashes)
> drop curs c
> declare c cursor for select numt from telephone
> *(one supposes that the table telephone has the telephone
> numbers which are text)
> open c
> fetch c into vnumt
> while sqlcode <> 100 then
>     load twork
>     fill
>     &vnumt
>     end
>     select tt1-tt2-tt3-tt4 into vtt1-vtt2-vtt3-vtt4 from  +
>     twork where count = last
>     *( the delimit ist still -)
>     update telephone set numt = (.vtt1+.vtt2+.vtt3+.vtt4) +
>     where current of c
>     fetch c into vnumt
> endwhile
> set delimit=,
> drop curs c
>
> Hope it helps
> Regards.
>                       J.J. Laubl�
> ----- Original Message -----
> From: "Troy Sosamon" <[EMAIL PROTECTED]>
> To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 20, 2003 4:14 PM
> Subject: [RBASE-L] - SRPL
>
>
> > Has anyone figured out how to use SRPL to not only remove a character, but
> > the spact too.
> > I need a function that will strip the dashes out of phone numbers.
> >
> > 123-4567 needs to come back 1234567.
> >
> > I can loop through and process on character at a time, but I would really
> > like to be able to get the results in a select w/o having to do that.
> >
> > Thanks,
> >
> > Troy
> >
>
>

Reply via email to