Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_repmot

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_REPMOT replaces a marker with the text representation of an
   ordinal number.

I/O


   Given:

      in       an arbitrary character string.

               help, in
                  STRING = Scalar

      marker   an arbitrary character string.

               help, marker
                  STRING = Scalar

               The first occurrence of `marker' in the input string is to be
               replaced by the text representation of the ordinal number
               `value'.

               Leading and trailing blanks in `marker' are NOT
               significant. In particular, no substitution is performed
               if `marker' is blank or empty.

      value    an arbitrary integer.

               help, value
                  LONG = Scalar

      rtcase   indicates the case of the replacement text.

               help, rtcase
                  STRING = Scalar

               `rtcase' may be any of the following:

                  rtcase   Meaning        Example
                  ------   -----------    -----------------------
                  U, u     Uppercase      ONE HUNDRED FIFTY-THIRD

                  L, l     Lowercase      one hundred fifty-third

                  C, c     Capitalized    One hundred fifty-third

   the call:

      cspice_repmot, in, marker, value, rtcase, out

   returns:

      out      the string obtained by substituting the text representation of
               the ordinal number `value' for the first occurrence of `marker'
               in the input string.

               help, out
                  STRING = Scalar

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) The following example illustrate the use of cspice_repmot to
      replace a marker within a string with the ordinal text
      corresponding to an integer.


      Example code begins here.


      PRO repmot_ex1

         ;;
         ;; 1. Uppercase
         ;;
         marker = '#'
         instr  = 'INVALID COMMAND. # WORD NOT RECOGNIZED.'

         cspice_repmot, instr, marker, 5L, 'U', outstr

         print, 'Case 1: Replacement text in uppercase.'
         print, '   Input : ', instr
         print, '   Output: ', outstr
         print, ' '

         ;;
         ;; 2. Lowercase
         ;;
         marker = ' XX '
         instr  = 'The XX word of the XX sentence was ...'

         cspice_repmot, instr, marker, 5L, 'L', outstr

         print, 'Case 2: Replacement text in lowercase.'
         print, '   Input : ', instr
         print, '   Output: ', outstr
         print, ' '

         ;;
         ;; 2. Capitalized
         ;;
         marker = ' XX '
         instr  = 'Name:  YY.  Rank:  XX.'

         cspice_repmc, instr, 'YY', 'Moriarty', outstr
         cspice_repmot, outstr, marker, 5L, 'C', outstr

         print, 'Case 3: Replacement text capitalized.'
         print, '   Input : ', instr
         print, '   Output: ', outstr

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Case 1: Replacement text in uppercase.
         Input : INVALID COMMAND. # WORD NOT RECOGNIZED.
         Output: INVALID COMMAND. FIFTH WORD NOT RECOGNIZED.

      Case 2: Replacement text in lowercase.
         Input : The XX word of the XX sentence was ...
         Output: The fifth word of the XX sentence was ...

      Case 3: Replacement text capitalized.
         Input : Name:  YY.  Rank:  XX.
         Output: Name:  Moriarty.  Rank:  Fifth.


Particulars


   This is one of a family of related routines for inserting values
   into strings. They are typically to construct messages that
   are partly fixed, and partly determined at run time. For example,
   a message like

      'The fifty-first picture was found in directory [USER.DATA].'

   might be constructed from the fixed string

      'The #1 picture was found in directory #2.'

   by the calls

      cspice_repmot, string, '#1', 51L, 'L', string
      cspice_repmc, string,  '#2', '[USER.DATA]', string

   which substitute the ordinal text 'fifty-first' and the character
   string '[USER.DATA]' for the markers '#1' and '#2' respectively.

   The complete list of routines is shown below.

      cspice_repmc    ( Replace marker with character string value )
      cspice_repmd    ( Replace marker with double precision value )
      cspice_repmf    ( Replace marker with formatted d.p. value   )
      cspice_repmi    ( Replace marker with integer value          )
      cspice_repml    ( Replace marker with logical value          )
      cspice_repmct   ( Replace marker with cardinal text          )
      cspice_repmot   ( Replace marker with ordinal text           )

Exceptions


   1)  If `marker' is blank or empty, or if `marker' is not a substring of
       `in', no substitution is performed. (`out' and `in' are identical.)

   2)  If the value of `rtcase' is not recognized, the error
       SPICE(INVALIDCASE) is signaled by a routine in the call tree
       of this routine. `out' is not changed.

   3)  If any of the input arguments, `in', `marker', `value' or
       `rtcase', is undefined, an error is signaled by the IDL error
       handling system.

   4)  If any of the input arguments, `in', `marker', `value' or
       `rtcase', is not of the expected type, or it does not have the
       expected dimensions and size, an error is signaled by the Icy
       interface.

   5)  If the output argument `out' is not a named variable, an error
       is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  `value' must be in the range accepted by the SPICELIB routine
       INTORD. This range is currently

          ( -10**12, 10**12 )

       Note that the endpoints of the interval are excluded.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Icy Version 1.0.0, 01-JUN-2021 (JDR)

Index_Entries


   replace marker with ordinal text



Fri Dec 31 18:43:07 2021