remsub |
Table of contents
ProcedureREMSUB ( Remove a substring ) SUBROUTINE REMSUB ( IN, LEFT, RIGHT, OUT ) AbstractRemove the substring (LEFT:RIGHT) from a character string. Required_ReadingNone. KeywordsASSIGNMENT CHARACTER STRING DeclarationsIMPLICIT NONE CHARACTER*(*) IN INTEGER LEFT INTEGER RIGHT CHARACTER*(*) OUT Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- IN I Input string. LEFT I Position of first character to be removed. RIGHT I Position of last character to be removed. OUT O Output string. Detailed_InputIN is an input character string, from which a substring is to be removed. LEFT, RIGHT are the ends of the substring to be removed. Detailed_OutputOUT is the output string. This is equivalent to the string that would be created by the concatenation OUT = IN(1 : LEFT-1) // IN(RIGHT+1 : ) If the string is too long to fit into OUT, it is truncated on the right. ParametersNone. Exceptions1) If LEFT > RIGHT, RIGHT < 1, LEFT < 1, RIGHT > LEN(IN), or LEFT > LEN(IN), the error SPICE(INVALIDINDEX) is signaled. FilesNone. ParticularsMove the characters, beginning with RIGHT, one at a time to the positions immediately following LEFT. This has the same effect as the concatenation OUT = IN(1 : LEFT-1) // IN(RIGHT+1 : ) Because this operation is not standard for strings of length (*), this routine does not use concatenation. ExamplesThe following examples illustrate the use of REMSUB. IN LEFT RIGHT OUT ----------------- ---- ----- ------------------------ 'ABCDEFGHIJ' 3 5 'ABFGHIJ' 'The best rabbit' 5 8 'The rabbit' 'The other woman' 1 4 'other woman' 'An Apple a day' 2 2 'A apple a day' 'An Apple a day' 5 2 An error is signaled. 'An Apple a day' 0 0 An error is signaled. 'An Apple a day' -3 3 An error is signaled. Whenever an error has been signaled, the contents of OUT are unpredictable. RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB Version 1.1.0, 20-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) (HAN) |
Fri Dec 31 18:36:42 2021