Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Urs Eggmann" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: Remove no numeric chars from string Date: Wed, 5 Dec 2012 22:20:39 +0100 Lines: 53 Message-ID: References: <1f9c00dd-db36-4de4-b134-669c2a522ac9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Trace: individual.net UC7FwPTr9AFZvfQNWW75ZQoDiLV9slJcmwc6ZYGtVJU8BK94MXhV4kolfJWLh65njo Cancel-Lock: sha1:kxnC2a5PEdPpwEvRzj4R5VIZCkk= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-EsetId: 35EFE320EBB6393261ACBA X-EsetScannerBuild: 12660 Xref: csiph.com comp.lang.clipper.visual-objects:4429 Hi Paulo, What about: FUNCTION RemoveNoNum(cNif) // e.g. cNif := "PT 123 A4 555 6 7 8 9 0 " LOCAL nLen AS DWORD LOCAL cResult , cTemp AS STRING LOCAL i AS DWORD LOCAL aArray AS ARRAY aArray := {} FOR i :=1 UPTO SLen(cNif) IF Between(Asc(SubStr(cNif , i , 1 ) ) , 48 , 57 ) // if numeric, save it AAdd(aArray , SubStr(cNif , i , 1 ) ) ENDIF NEXT i FOR i :=1 UPTO ALen(aArray) cResult += (aArray[i]) // form the result string NEXT i RETURN cResult // 1234567890 regards Urs "Paulo Oliveira" schrieb im Newsbeitrag news:1f9c00dd-db36-4de4-b134-669c2a522ac9@googlegroups.com... > Hi all, > > I have a this code to check if a string have not numeric chars: > > FOR i:=1 UPTO SLen(cNif) > //GARANTIR QUE SO HA NUMEROS > IF !Between(Asc(SubStr(cNif,i, 1)), 48, 57) > lResult:=FALSE > BREAK 1 > ENDIF > NEXT i > > Now i need to remove the no numeric chars from the string: > > PT123 456 789 -----> 12345678 > > Some ideas > TIA > Paulo Oliveira > >