home *** CD-ROM | disk | FTP | other *** search
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- '% (C) 1987 HUMBLEWARE Custom Programming Author: Lawrence A. Westhaver %
- '% 247 Paul Martin Drive, Baltimore MD 21227 (301) 799-1975 %
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- '% %
- '% FILENAME: STRIP.SUB LAST UPDATE: 05-24-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. %
- '% %
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- SUB STRIPALL(IN$,OUT$) Static
-
-
- '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 LEWP%=1 TO LEN(IN$)
- IF MID$(IN$,LEWP%,1)<>" " THEN TEMP$=TEMP$+MID$(IN$,LEWP%,1)
- NEXT LEWP%
- OUT$=TEMP$
-
-
- END SUB 'stripall
-
-
-
- SUB STRIPLR(IN$,OUT$) Static
-
-
- '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 STRIPL(IN$,OUT$) Static
-
-
- '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
-
- STRIPL:
-
- IF MID$(IN$,POINTER%,1)=" " THEN
- POINTER%=POINTER%+1
- GOTO STRIPL
- END IF
-
- OUT$=MID$(IN$,POINTER%)
-
-
- END SUB 'stripl
-
-
-
- SUB STRIPR(IN$,OUT$) Static
-
-
- '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$)
-
- STRIPR:
-
- IF MID$(IN$,POINTER%,1)=" " THEN
- POINTER%=POINTER%-1
- GOTO STRIPR
- END IF
-
- OUT$=LEFT$(IN$,POINTER%)
-
-
- END SUB 'stripr
-