Category : BASIC Source Code
Archive   : HUMBLE.ZIP
Filename : STRIP.SUB
'% (C) 1987 HUMBLEWARE Custom Programming Author: Lawrence A. Westhaver %
'% 247 Paul Martin Drive, Baltimore MD 21227 (301) 799-1975 %
'% Visit the QuickBASIC BBS at (301) 799-8564 %
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'% %
'% FILENAME: STRIP.SUB LAST UPDATE: 11-28-1987 %
'% %
'% DESCRIPTION: Four routines that strip spaces (ASCII 32) from an input %
'% string. %
'% %
'% CALL: CALL STRIPxxx(IN$,OUT$) %
'% %
'% STRIPALL: Strips all spaces from a string regardless of %
'% position. %
'% %
'% STRIPLR: Strips spaces from the left and right sides %
'% of a string. %
'% %
'% STRIPL: Strips spaces from the left side of a string. %
'% %
'% STRIPR: Strips spaces from the right side of a string. %
'% %
'% INPUTS: IN$ = Input string. %
'% %
'% OUTPUTS: OUT$ = Copy of input string with spaces stripped. %
'% %
'% NOTE: These routines do not alter the original string specified %
'% in IN$. They return a copy of the original string in OUT$ %
'% with spaces stripped. %
'% %
'% If you want the original string altered, then call the %
'% needed routine like this: %
'% %
'% CALL STRIPxxx(IN$,IN$) %
'% %
'% This will cause the copy of the original string to be %
'% assigned to the original. %
'% %
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARE SUB STRIPL (IN$, OUT$)
DECLARE SUB STRIPR (IN$, OUT$)
SUB STRIPALL (IN$, OUT$)
'check if string has only spaces
IF IN$ = STRING$(LEN(IN$), " ") THEN
OUT$ = ""
EXIT SUB
END IF
'check for null string
IF IN$ = "" THEN
OUT$ = ""
EXIT SUB
END IF
'strip out spaces
TEMP$ = ""
FOR INDEX% = 1 TO LEN(IN$)
IF MID$(IN$, INDEX%, 1) <> " " THEN TEMP$ = TEMP$ + MID$(IN$, INDEX%, 1)
NEXT INDEX%
OUT$ = TEMP$
END SUB 'stripall
SUB STRIPL (IN$, OUT$)
'check if string has only spaces
IF IN$ = STRING$(LEN(IN$), " ") THEN
OUT$ = ""
EXIT SUB
END IF
'check for null string
IF IN$ = "" THEN
OUT$ = ""
EXIT SUB
END IF
'strip left hand spaces
POINTER% = 1
DO
IF MID$(IN$, POINTER%, 1) = " " THEN
POINTER% = POINTER% + 1
ELSE
EXIT DO
END IF
LOOP
OUT$ = MID$(IN$, POINTER%)
END SUB 'stripl
SUB STRIPLR (IN$, OUT$)
'check if string has only spaces
IF IN$ = STRING$(LEN(IN$), " ") THEN
OUT$ = ""
EXIT SUB
END IF
'check for null string
IF IN$ = "" THEN
OUT$ = ""
EXIT SUB
END IF
'call strip left
CALL STRIPL(IN$, OUT$)
'call strip right
CALL STRIPR(OUT$, OUT$)
END SUB 'striplr
SUB STRIPR (IN$, OUT$)
'check if string has only spaces
IF IN$ = STRING$(LEN(IN$), " ") THEN
OUT$ = ""
EXIT SUB
END IF
'check for null string
IF IN$ = "" THEN
OUT$ = ""
EXIT SUB
END IF
'strip right hand spaces
POINTER% = LEN(IN$)
DO
IF MID$(IN$, POINTER%, 1) = " " THEN
POINTER% = POINTER% - 1
ELSE
EXIT DO
END IF
LOOP
OUT$ = LEFT$(IN$, POINTER%)
END SUB 'stripr
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/