Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #4429

Re: Remove no numeric chars from string

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:20 +0100
Message-ID <ai9s62FfflsU1@mid.individual.net> (permalink)
References <1f9c00dd-db36-4de4-b134-669c2a522ac9@googlegroups.com>

Show all headers | View raw


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" <paulo@clipinfor.com> 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
>
> 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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