astrip |
Table of contents
ProcedureASTRIP ( STRIP Ascii characters from a string ) SUBROUTINE ASTRIP ( INSTR, ASCIIB, ASCIIE, OUTSTR ) AbstractRemove from a character string all characters which fall between specified starting and ending characters, inclusive. Required_ReadingNone. KeywordsASCII CHARACTER DeclarationsIMPLICIT NONE CHARACTER*(*) INSTR CHARACTER*1 ASCIIB CHARACTER*1 ASCIIE CHARACTER*(*) OUTSTR Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- INSTR I Input string. ASCIIB I First ASCII character in range to be stripped. ASCIIE I Last ASCII character in range to be stripped. OUTSTR O Output (stripped) string. Detailed_InputINSTR is a character string from which all characters between ASCIIB and ASCIIE, inclusive, are to be removed. ASCIIB is the first ASCII character in the range of characters to be removed from the input string. ASCIIB is itself removed from the string, if it occurs. ASCIIE is the last ASCII character in the range of characters to be removed from the input string. ASCIIE is itself removed from the string, if it occurs. Detailed_OutputOUTSTR is the input string after all the character between ASCIIB and ASCIIE, inclusive, have been removed. If OUTSTR is not large enough to hold the output string, it is truncated on the right. OUTSTR may overwrite INSTR. ParametersNone. ExceptionsError free. FilesNone. ParticularsASTRIP checks each character in INSTR to determine if it falls between the characters ASCIIB and ASCIIE. If so this character is removed from the string (and the string is shortened). Remaining characters are copied to the output string. ExamplesThe following examples illustrate the use of ASTRIP. ASCIIB = 'b' ASCIIE = 'k' INSTR = 'Now is the time for all good men to come quick.' OUTSTR = 'Now s t tm or all oo mn to om qu.' ASCIIB = 'a' ASCIIE = 'z' INSTR = 'SELECT column TIME FROM table TEST' OUTSTR = 'SELECT TIME FROM TEST' ASCIIB = 'a' ASCIIE = 'z' INSTR = 'this is going to be an empty string' OUTSTR = ' ' ASCIIB = '!' ASCIIE = '!' INSTR = 'Only 32 more shopping days until Christmas!' OUTSTR = 'Only 32 more shopping days until Christmas' ASTRIP may also be used to strip ASCII control characters (line feeds, tab stops, and so on), as shown in the example below. ASCIIB = CHAR ( 0 ) ASCIIE = CHAR ( 31 ) CALL ASTRIP ( STRING, ASCIIB, ASCIIE, STRING ) Restrictions1) If ASCIIB and ASCIIE are not properly ordered (that is, if ICHAR(ASCIIB) is not less than or equal to ICHAR(ASCIIE)) then ASTRIP will not function as described. (In fact, it will copy the input string to the output string without change.) Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB Version 1.1.0, 12-AUG-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) (IMU) |
Fri Dec 31 18:35:58 2021