07-29-2003, 07:40 AM
This isn't a request for code... actually I'm going to give it to you! The sub gets the new spaceless string as well as the number of spaces that were in the original string. Perhaps someone will have a use for it...
I realize I could've just written it as part of the main module for the program but I wanted to be able to move it a bit more easily. As for the 'db those are just my debug checkpoints so instead of manually debugging it, I get to watch the values on screen while it does the work. I also have a function that I wrote in C++ for this as well if anybody is interested in getting it PM me.
Oh! Check out www.arcticgeckostudios.com we're still looking for more members
Code:
' Just a small sub to remove spaces for an input string
' 07-28-2003, AGs
' Use as you like :D
DECLARE SUB SpcRemover ()
SCREEN 13
CALL SpcRemover
SUB SpcRemover
INPUT "Enter string : ", UserString$
'db Print UserString$
StringLen = LEN(UserString$)
'db PRINT StringLen
FOR x = 1 TO StringLen
IF MID$(UserString$, x, 1) = " " THEN
SpaceCount = SpaceCount + 1
ELSE
CleanString$ = CleanString$ + MID$(UserString$, x, 1)
END IF
NEXT x
'db PRINT SpaceCount
'db PRINT CleanString$
END SUB
I realize I could've just written it as part of the main module for the program but I wanted to be able to move it a bit more easily. As for the 'db those are just my debug checkpoints so instead of manually debugging it, I get to watch the values on screen while it does the work. I also have a function that I wrote in C++ for this as well if anybody is interested in getting it PM me.
Oh! Check out www.arcticgeckostudios.com we're still looking for more members