CHRPAK 
 routines for handling character strings
    
    
    
      CHRPAK 
      is a FORTRAN77 library which 
      can handle characters and strings of characters.  
    
    
      CHRPAK began when I simply wanted to be able to capitalize
      a string.  Now it has expanded to a number of interesting uses.
      Many unusual situations are provided for, including
      
 
        - 
          string '31.2' <=> numeric value 31.2;
        
 
        - 
          uppercase <=> lowercase;
        
 
        - 
          removal of control characters or blanks;
        
 
        - 
          sorting, merging, searching.
        
 
      
    
    
      Many of the routine names begin with the name of the data type they 
      operate on:
      
        - 
          B4 - a 4 byte word;
        
 
        - 
          CH - a character;
        
 
        - 
          CHVEC - a vector of characters;
        
 
        - 
          DEC - a decimal fraction;
        
 
        - 
          DIGIT - a character representing a numeric digit;
        
 
        - 
          I4 - an integer ( kind = 4 );
        
 
        - 
          R4 - a real ( kind = 4 );
        
 
        - 
          R8 - a real ( kind = 8 );
        
 
        - 
          RAT - a ratio I/J;
        
 
        - 
          S - a string;
        
 
        - 
          SVEC - a vector of strings;
        
 
        - 
          SVECI - a vector of strings, implicitly capitalized;
        
 
      
    
    
      Licensing:
    
    
      The computer code and data files described and made available on this web page 
      are distributed under
      the GNU LGPL license.
    
    
      Languages:
    
    
      CHRPAK is available in
      a C version and
      a C++ version and
      a FORTRAN77 version and
      a FORTRAN90 version and
      a MATLAB version and
      a Python version.
    
    
      Reference:
    
    
      
        - 
          Carl Branden, John Tooze,
          Introduction to Protein Structure,
          Second Edition,
          Garland Publishing, 1999,
          ISBN: 0815323050,
          LC: QP551.B7635.
         
        - 
          Paul Bratley, Bennett Fox, Linus Schrage,
          A Guide to Simulation,
          Second Edition,
          Springer, 1987,
          ISBN: 0387964673,
          LC: QA76.9.C65.B73.
         
        - 
          IEEE Standards Committee 754,
          IEEE Standard for Binary Floating Point Arithmetic,
          ANSI/IEEE Standard 754-1985,
          SIGPLAN Notices,
          Volume 22, Number 2, 1987, pages 9-25.
         
        - 
          Donald Knuth,
          The Art of Computer Programming,
          Volume 3, Sorting and Searching,
          Second Edition,
          Addison Wesley, 1998,
          ISBN: 0201896850,
          LC: QA76.6.K64.
         
        - 
          Albert Nijenhuis, Herbert Wilf,
          Combinatorial Algorithms for Computers and Calculators,
          Academic Press, 1978,
          ISBN: 0-12-519260-6,
          LC: QA164.N54.
         
      
    
    
      Source Code:
    
    
      
    
    
      Examples and Tests:
    
    
      
    
    
      List of Routines:
    
    
      
        - 
          A_TO_I4 returns the index of an alphabetic character.
        
 
        - 
          BINARY_TO_I4 converts a binary representation into an integer value.
        
 
        - 
          BINARY_TO_R4 converts a binary representation into an R4.
        
 
        - 
          CH_CAP capitalizes a single character.
        
 
        - 
          CH_EQI is a case insensitive comparison of two characters for equality.
        
 
        - 
          CH_INDEX_FIRST is the first occurrence of a character in a string.
        
 
        - 
          CH_INDEX_LAST is the last occurrence of a character in a string.
        
 
        - 
          CH_IS_ALPHA is TRUE if CH is an alphabetic character.
        
 
        - 
          CH_IS_ALPHANUMERIC is TRUE if CH is alphanumeric.
        
 
        - 
          CH_IS_CONTROL is TRUE if a character is a control character.
        
 
        - 
          CH_IS_DIGIT returns TRUE if a character is a decimal digit.
        
 
        - 
          CH_IS_SPACE is TRUE if a character is a whitespace character.
        
 
        - 
          CH_IS_UPPER is TRUE if CH is an upper case letter.
        
 
        - 
          CH_LOW lowercases a single character.
        
 
        - 
          CH_ROMAN_TO_I4 returns the integer value of a single Roman digit.
        
 
        - 
          CH_SCRABBLE returns the character on a given Scrabble tile.
        
 
        - 
          CH_SWAP swaps two characters.
        
 
        - 
          CH_TO_DIGIT returns the integer value of a base 10 digit.
        
 
        - 
          CH_TO_DIGIT_BIN returns the integer value of a binary digit.
        
 
        - 
          CH_TO_DIGIT_HEX returns the integer value of a hexadecimal digit.
        
 
        - 
          CH_TO_DIGIT_OCT returns the integer value of an octal digit.
        
 
        - 
          CH_TO_ROT13 converts a character to its ROT13 equivalent.
        
 
        - 
          CH_TO_SCRABBLE returns the Scrabble index of a character.
        
 
        - 
          CH_UNIFORM returns a scaled pseudorandom CH.
        
 
        - 
          DIGIT_BIN_TO_CH returns the character representation of a binary digit.
        
 
        - 
          DIGIT_INC increments a decimal digit.
        
 
        - 
          DIGIT_OCT_TO_CH returns the character representation of an octal digit.
        
 
        - 
          DIGIT_TO_CH returns the character representation of a decimal digit.
        
 
        - 
          FILE_NAME_INC generates the next filename in a series.
        
 
        - 
          GET_UNIT returns a free FORTRAN unit number.
        
 
        - 
          HEX_TO_I4 converts a hexadecimal string to its integer value.
        
 
        - 
          HEX_TO_S converts a hexadecimal string into characters.
        
 
        - 
          I4_GCD finds the greatest common divisor of I and J.
        
 
        - 
          I4_HUGE returns a "huge" I4.
        
 
        - 
          I4_LENGTH computes the number of characters needed to print an integer.
        
 
        - 
          I4_SWAP switches two I4's.
        
 
        - 
          I4_TO_A returns the I-th alphabetic character.
        
 
        - 
          I4_TO_AMINO_CODE converts an integer to an amino code.
        
 
        - 
          I4_TO_HEX_DIGIT converts a (small) I4 to a hexadecimal digit.
        
 
        - 
          I4_TO_ISBN converts an I4 to an ISBN digit.
        
 
        - 
          I4_TO_MONTH_ABB returns the 3 character abbreviation of a given month.
        
 
        - 
          I4_TO_S_LEFT converts an I4 to a left-justified string.
        
 
        - 
          I4_UNIFORM returns a scaled pseudorandom I4.
        
 
        - 
          I4VEC_INDICATOR sets an I4VEC to the indicator vector.
        
 
        - 
          I4VEC_PRINT prints an I4VEC.
        
 
        - 
          ISBN_TO_I4 converts an ISBN character into an integer.
        
 
        - 
          NUMBER_INC increments the integer represented by a string.
        
 
        - 
          R4_UNIFORM_01 returns a unit pseudorandom R4.
        
 
        - 
          S_ADJUSTL flushes a string left.
        
 
        - 
          S_ADJUSTR flushes a string right.
        
 
        - 
          S_AFTER_SS_COPY copies a string after a given substring.
        
 
        - 
          S_BEGIN is TRUE if one string matches the beginning of the other.
        
 
        - 
          S_BLANK_DELETE removes blanks from a string, left justifying the remainder.
        
 
        - 
          S_BLANKS_DELETE replaces consecutive blanks by one blank.
        
 
        - 
          S_CAP replaces any lowercase letters by uppercase ones in a string.
        
 
        - 
          S_CAT concatenates two strings to make a third string.
        
 
        - 
          S_CAT1 concatenates two strings, with a single blank separator.
        
 
        - 
          S_CH_BLANK replaces each occurrence of a particular character by a blank.
        
 
        - 
          S_CH_COUNT counts occurrences of a particular character in a string.
        
 
        - 
          S_CH_DELETE removes all occurrences of a character from a string.
        
 
        - 
          S_CHOP "chops out" a portion of a string, and closes up the hole.
        
 
        - 
          S_CONTROL_BLANK replaces control characters with blanks.
        
 
        - 
          S_EQI is a case insensitive comparison of two strings for equality.
        
 
        - 
          S_FIRST_NONBLANK returns the location of the first nonblank.
        
 
        - 
          S_INDEX_LAST finds the LAST occurrence of a given substring.
        
 
        - 
          S_INDEXI is a case-insensitive INDEX function.
        
 
        - 
          S_LEN_TRIM returns the length of a string to the last nonblank.
        
 
        - 
          S_LOW replaces all uppercase letters by lowercase ones.
        
 
        - 
          S_REVERSE reverses the characters in a string.
        
 
        - 
          S_TO_I4 reads an I4 from a string.
        
 
        - 
          S_TO_I4VEC reads an I4VEC from a string.
        
 
        - 
          S_TO_L reads a logical value from a string.
        
 
        - 
          S_TO_R4 reads an R4 from a string.
        
 
        - 
          S_TO_R4VEC reads an R4VEC from a string.
        
 
        - 
          S_TO_R8 reads an R8 from a string.
        
 
        - 
          S_TO_R8VEC reads an R8VEC from a string.
        
 
        - 
          S_TO_ROT13 "rotates" the alphabetical characters in a string by 13 positions.
        
 
        - 
          S_WORD_COUNT counts the number of "words" in a string.
        
 
        - 
          S_WORD_EXTRACT_FIRST extracts the first word from a string.
        
 
        - 
          SORT_HEAP_EXTERNAL externally sorts a list of items into ascending order.
        
 
        - 
          TIMESTAMP prints out the current YMDHMS date as a timestamp.
        
 
      
    
    
      You can go up one level to 
      the FORTRAN77 source codes.
    
    
    
      Last revised on 04 February 2012.