cyclec |
Table of contents
ProcedureCYCLEC ( Cycle a character string ) SUBROUTINE CYCLEC ( INSTR, DIR, NCYCLE, OUTSTR ) AbstractCycle the contents of a character string to the left or right. Required_ReadingNone. KeywordsCHARACTER UTILITY DeclarationsIMPLICIT NONE CHARACTER*(*) INSTR CHARACTER*1 DIR INTEGER NCYCLE CHARACTER*(*) OUTSTR Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- INSTR I String to be cycled. DIR I Direction to cycle. NCYCLE I Number of times to cycle. OUTSTR O Cycled string. Detailed_InputDIR is the direction in which the characters in the string are to be cycled. 'L' or 'l' to cycle left. 'R' or 'r' to cycle right. NCYCLE is the number of times the characters in the string are to be cycled. INSTR is the string to be cycled. Detailed_OutputOUTSTR is the input string after it has been cycled. ParametersNone. Exceptions1) If the direction flag is not one of the acceptable values 'r', 'R', 'l', 'L', the error SPICE(INVALIDDIRECTION) is signaled. FilesNone. ParticularsA string is cycled when its contents are shifted to the left or right by one place. A character pushed off one end of the string is brought around to the other end of the string instead of disappearing. Leading and trailing blanks are treated just like any other characters. If the output string is not large enough to contain the input string, the cycled string is truncated on the right. Examples'abcde' cycled left twice becomes 'cdeab' 'abcde ' cycled left twice becomes 'cde ab' 'abcde' cycled right once becomes 'eabcd' 'Apple ' cycled left six times becomes 'Apple ' 'Apple ' cycled right twenty-four times becomes 'Apple ' Restrictions1) The memory used for the output string must be identical to that used for the input string or be disjoint from the input string memory. That is: CALL CYCLEN ( STRING, DIR, NCYCLE, STRING ) will produce correct results with output overwriting input. CALL CYCLEN ( STRING(4:20), DIR, NCYCLE, STRING(2:18) ) will produce garbage results. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB Version 1.2.0, 12-AUG-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 1.1.0, 18-JUN-1999 (WLT) Fixed problem with unbalanced CHKIN/CHKOUT calls. 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) (WLT) |
Fri Dec 31 18:36:06 2021