#64019 - 2002-03-22 04:40 PM
Removing commas from string
|
Viggen
Starting to like KiXtart
Registered: 2002-03-22
Posts: 110
|
Hello!
How do I remove commas from a string?
I have a string that look like this: 1,234,567
I need to get it to look like this: 1234567
I think that I can use SPLIT() to create some sort of array, but I can't get it "back together"
It seems to be quite simple, but I'm sitting here, going: -"que... Me know nothing"
/V.O
|
|
Top
|
|
|
|
#64020 - 2002-03-22 04:57 PM
Re: Removing commas from string
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
You could use your old favourites InStr() and SubStr...
code:
$sData="1,234,567" $i=InStr($sData,",") While $i $sData=SubStr($sData,1,$i-1) + SubStr($sData,$i+1) $i=InStr($sData,",") Loop
(This code not tested, but you get the idea )
|
|
Top
|
|
|
|
#64023 - 2002-03-22 07:06 PM
Re: Removing commas from string
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
Well... if 3.62, then this should do it.
code:
break on $sData="1,234,567" $i=InStr($sData,",") While $i $sData=SubStr($sData,1,$i-1) + SubStr($sData,$i+1,Len($sData)) $i=InStr($sData,",") $sData ? Loop Get $_
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
|
Top
|
|
|
|
#64026 - 2002-03-22 11:13 PM
Re: Removing commas from string
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
here some thing like this..
code:
$string = "1,234,567" $newstring = ""
for each $thing in split($string,",") $newstring = $newstring+$thing next ? $newstring
|
|
Top
|
|
|
|
#64028 - 2002-03-23 02:24 PM
Re: Removing commas from string
|
Viggen
Starting to like KiXtart
Registered: 2002-03-22
Posts: 110
|
I just had to go downtown to work an test this....
It works!!
thanks guys!
|
|
Top
|
|
|
|
#64031 - 2002-03-24 08:09 AM
Re: Removing commas from string
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Yeah... dedication Les, something you used to have before you got tired of your job
Hey... maybe you could use a few copies of VMWARE VMWARE - Productivity Tool for Technical Professionals to run an "internal" network. Have not tried it, but hey... it may be possible if it supports virtual nic
Maybe I'll try that some time myself and see if it works. Run your own little network of machines all from one machine.
|
|
Top
|
|
|
|
#64032 - 2002-03-24 10:30 AM
Re: Removing commas from string
|
Anonymous
Anonymous
Unregistered
|
Vmware works better than perfect; that is how I test my client server projects. If I want to copy files from the vmware virt. computer to my host w2k box I prefer ftp.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2870 anonymous users online.
|
|
|