Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #4430
| From | "Urs Eggmann" <Urs.Eggmann@shinternet.ch> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Remove no numeric chars from string |
| Date | 2012-12-05 22:38 +0100 |
| Message-ID | <ai9t7iFfn08U1@mid.individual.net> (permalink) |
| References | <1f9c00dd-db36-4de4-b134-669c2a522ac9@googlegroups.com> <8594c8fa-ebab-4c64-8551-30d7bf251ec5@googlegroups.com> |
Hi Leo
I experimented also with the func Stuff, but by replacing non digits with
NULL_STRING inside the loop, the length of string is altered inside the func
so the wrong characters will be stuffed.
regards
Urs
"Leo_Bond" <l.bond@bk.ru> schrieb im Newsbeitrag
news:8594c8fa-ebab-4c64-8551-30d7bf251ec5@googlegroups.com...
среда, 5 декабря 2012 г., 22:31:47 UTC+4 пользователь Paulo Oliveira
написал:
> 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
Hi, Paulo!
Maybe this will help:
FUNCTION StripChars(cStringParameter AS STRING) AS STRING PASCAL
// Strips all non-numeric characters
// StripChars (" (123) 456-78-90") ---> "1234567890"
LOCAL i, dwStringLength AS DWORD
dwStringLength:=SLen(cStringParameter)
FOR i:=1 UPTO dwStringLength
IF !IsDigit(String2Psz(SubStr3(cStringParameter,i,1)))
cStringParameter:=Stuff(cStringParameter,i,1,NULL_STRING)
ENDIF
NEXT
RETURN cStringParameter
Good luck!
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Remove no numeric chars from string Paulo Oliveira <paulo@clipinfor.com> - 2012-12-05 10:31 -0800
Re: Remove no numeric chars from string dlzc <dlzc1@cox.net> - 2012-12-05 11:37 -0800
Re: Remove no numeric chars from string Leo_Bond <l.bond@bk.ru> - 2012-12-05 12:58 -0800
Re: Remove no numeric chars from string "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2012-12-05 22:38 +0100
Re: Remove no numeric chars from string "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2012-12-05 22:20 +0100
Re: Remove no numeric chars from string "Willie Moore" <williem@wmconsulting.com> - 2012-12-05 18:50 -0600
Re: Remove no numeric chars from string "Francesco F." <francescangeli.f.remove@remove.gmail.com> - 2012-12-06 07:45 +0100
Re: Remove no numeric chars from string Paulo Oliveira <paulo@clipinfor.com> - 2012-12-06 02:59 -0800
csiph-web