string.Replace

BlitzMax Forums/BlitzMax Programming/string.Replace

nawi(Posted 2005) [#1]
String replace is not giving results as expected. I want to result every two spaces " " -> " ". As you can see there are left some doublespaces.
Print "test1 test2 test3 ".Replace$(" "," ")

That should print "test1 test2 test3" but it doesnt.


Difference(Posted 2005) [#2]
While Instr(s,"  ")
   s = s.Replace("  "," ")
Wend



nawi(Posted 2005) [#3]
Yeah its a workaround, just thought it's a good thing to point out. Becose I believe Replace should not act the way it is now.


Curtastic(Posted 2005) [#4]
It should work this way, because if it didn't then this would make an endless amount of e's:
"test".replace("e","ee")


taxlerendiosk(Posted 2005) [#5]
Yeah, this is the way I would expect it to function.