Replying to:12Me21
for example, if you want to remove spaces you might do
NEWSTRING$="" FOR I=0 TO LEN(STRING$)-1 IF MID$(STRING$,I,1)!=" " THEN NEWSTRING$=NEWSTRING$+MID$(STRING$,I,1) NEXTor better yet:
FOR I=0 TO LEN(STRING$)-1 IF STRING$[I]==" " THEN STRING$=SUBST$(STRING$,I,"",1):DEC I NEXTbut the best way is:
FOR I=0 TO LEN(STRING$)-1 IF STRING$[I]==" " THEN STRING$[I]="" NEXT(it seems so obvious, why is this not more well known)
Uh, no. The "best way" is not the best way, it is broken. If two spaces are in a row, only one will be removed. How about:
WHILE (INSTR(STRING$," ")>=0) STRING$[INSTR(STRING$," ")]="" WEND