intord |
Table of contents
ProcedureINTORD ( Convert an integer to ordinal text ) SUBROUTINE INTORD ( N, STRING ) AbstractConvert an integer to an equivalent written ordinal phrase. For example, convert 121 to 'ONE HUNDRED TWENTY-FIRST'. Required_ReadingNone. KeywordsCONVERSION PARSING STRING UNITS UTILITY DeclarationsIMPLICIT NONE INTEGER MAXORD PARAMETER ( MAXORD = 148 ) INTEGER N CHARACTER*(*) STRING Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- N I An integer (less than 10**12 in absolute value). STRING O An English string representing the ordinal of N. Detailed_InputN is an integer (less than 10**12 in absolute value). Moreover, if N is less than zero, -N must be a a legitimate number on the host machine. In the context of this routine N represents the ranking of some item within a group. Detailed_OutputSTRING is the English ordinal equivalent of N. STRING will contain only upper case letters. ParametersMAXORD is one more than the length of the longest ordinal string that can be produced by a call to this routine: One string of maximum length is: 'NEGATIVE ' // 'SEVEN HUNDRED SEVENTY-SEVEN BILLION ' // 'SEVEN HUNDRED SEVENTY-SEVEN MILLION ' // 'SEVEN HUNDRED SEVENTY-SEVEN THOUSAND ' // 'SEVEN HUNDRED SEVENTY-SEVENTH' It has 147 characters. The parameter MAXORD is used to declare a local string of sufficient length to allow the construction of any ordinal string. ExceptionsError free. 1) If the resulting ordinal is longer than the output string, it will be truncated on the right, leaving only the most significant portion of the ordinal. FilesNone. ParticularsThis is used primarily for generating error messages. For example, if the third letter or token in a string is in error, it might be desirable to supply a message like the following: 'The third token of 31-JAN-198$ is not a valid year.' ExamplesN STRING ------ ------------------------------------------- -6 NEGATIVE SIXTH 1 FIRST 2 SECOND 3 THIRD 4 FOURTH 20 TWENTIETH 21 TWENTY-FIRST 99 NINETY-NINTH 82131 EIGHTY-TWO THOUSAND ONE HUNDRED THIRTY-FIRST Restrictions1) Whatever restrictions apply to INTTXT apply to this routine as well. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) W.L. Taber (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, 15-AUG-1990 (WLT) |
Fri Dec 31 18:36:28 2021