Perhaps on occasion you need to remove all spaces in a give string.
Here is a function that will do the job:
'~trimAllSpaces (removes all spaces from a string)
LOCAL FN trimAllSpaces$( textStr AS STR255 )
DIM trimspace AS INTEGER
DIM theCharStr AS STR255
DIM charactersStr AS STR255
DIM trimmedCharStr AS STR255
trimspace = 0
theCharStr = ""
charactersStr = ""
trimmedCharStr = ""
LONG IF INSTR( 1, textStr, " ") = 0
trimmedCharStr = textStr
EXIT FN
END IF
FOR trimspace = 1 TO textStr[0]
theCharStr = MID$( textStr, trimspace, 1 )
charactersStr = charactersStr + theCharStr
LONG IF theCharStr = " "
charactersStr = MID$( charactersStr, 1, charactersStr[0] - 1 )
END IF
NEXT trimspace
trimmedCharStr = charactersStr
END FN = trimmedCharStr
DIM myStr AS STR255
myStr = "I wonder how many spaces will be trimmed from this
string ! ? ! ? ! "
PRINT:Print "FN trimAllSpaces$ all the spaces in this string:"
PRINT FN trimAllSpaces$( myStr )