shiftr |
Table of contents
ProcedureSHIFTR ( Shift right ) SUBROUTINE SHIFTR ( IN, NSHIFT, FILLC, OUT ) AbstractShift the contents of a character string to the right. Characters moved past the end of the input string are lost. Vacant spaces are filled with a specified character. Required_ReadingNone. KeywordsCHARACTER UTILITY DeclarationsIMPLICIT NONE CHARACTER*(*) IN INTEGER NSHIFT CHARACTER*1 FILLC CHARACTER*(*) OUT Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- IN I Input string. NSHIFT I Number of times to shift. FILLC I Character to fill spaces left vacant. OUT O Shifted string. Detailed_InputIN is the input character string. NSHIFT is the number of times the string is to be shifted. If NSHIFT is negative, OUT will be identical to IN. FILLC is the character with which spaces left vacant by the shift are to be filled. Detailed_OutputOUT is the output string. This is the input string, shifted N times, filled with FILLC. OUT may overwrite IN. ParametersNone. ExceptionsError free. FilesNone. ParticularsAs a string is shifted left or right, the leftmost or rightmost characters of the string disappear (as if pushed off the end of the string). This is .TRUE. regardless of the length of the output string. The remaining characters are shifted simultaneously, and the spaces vacated by those characters are filled with a replacement character. ExamplesIf FILLC = ' ' 'abcde' shifted left twice becomes 'cde ' 'abcde' shifted right once becomes ' abcd' If FILLC = '.' '12345 ' shifted right once becomes '.12345' 'Apple ' shifted left ten times becomes '......' Given the declarations CHARACTER*3 SHORT CHARACTER*10 LONG The calls CALL SHIFTR ( 'abcde ', 2, '-', SHORT ) CALL SHIFTR ( 'abcde ', 2, '-', LONG ) yield the strings SHORT = '--a' LONG = '--abcd ' while the calls CALL SHIFTL ( 'abcde ', 2, '-', SHORT ) CALL SHIFTL ( 'abcde ', 2, '-', LONG ) yield the strings SHORT = 'cde' LONG = 'cde .. ' RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) M.J. Spencer (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL) VersionSPICELIB Version 2.1.0, 12-AUG-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 2.0.1, 22-AUG-2001 (EDW) Corrected ENDDO to END DO. SPICELIB Version 2.0.0, 01-SEP-1994 (MJS) This version correctly handles negative shifts. 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 (IMU) |
Fri Dec 31 18:36:48 2021