chrpak
    
    
    
      chrpak,
      an Octave code which
      handles characters and strings.
    
    
      The code 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;
        
 
        - 
          R8 - a double precision real;
        
 
        - 
          RAT - a ratio I/J;
        
 
        - 
          S - a string;
        
 
        - 
          SVEC - a vector of strings;
        
 
        - 
          SVECI - a vector of strings, implicitly capitalized;
        
 
      
    
    
      Licensing:
    
    
      The information on this web page is distributed under the MIT license.
    
    
      Languages:
    
    
      chrpak is available in
      a C version and
      a C++ version and
      a Fortran90 version and
      a MATLAB version and
      an Octave version and
      a Python version.
    
    
      Related Software and Data:
    
    
      
      chrpak_test
    
    
      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:
    
    
      
        - 
          a_to_i4.m
          returns the index of an alphabetic character;
        
 
        - 
          base_to_i4.m
          returns the value of an integer represented in some base;
        
 
        - 
          binary_to_i4.m
          converts a binary representation into an integer value;
        
 
        - 
          binary_to_r8.m
          converts a binary representation into a real value;
        
 
        - 
          boolean_to_string.m,
          returns "True" or "False", given a boolean value.
        
 
        - 
          ch_cap.m
          returns the capitalized version of a character;
        
 
        - 
          ch_eqi.m
          returns TRUE if a two characters are equal (ignoring case);
        
 
        - 
          ch_extract.m
          extracts the next nonblank character from a string;
        
 
        - 
          ch_index.m
          returns the first occurrence of a character in a string;
        
 
        - 
          ch_index_last.m
          returns the last occurrence of a character in a string;
        
 
        - 
          ch_indexi.m
          returns the first occurrence of a character in a string,
          without regard to case;
        
 
        - 
          ch_is_alpha.m
          returns TRUE if a character is alphabetic;
        
 
        - 
          ch_is_alphanumeric.m
          returns TRUE if a character is alphanumeric;
        
 
        - 
          ch_is_control.m
          returns TRUE if a character is a control character;
        
 
        - 
          ch_is_digit.m
          returns TRUE if a character is a decimal digit;
        
 
        - 
          ch_is_format_code.m
          returns TRUE if a character is a legal Fortran format code;
        
 
        - 
          ch_is_isbn_digit.m
          returns TRUE if a character is an ISBN digit;
        
 
        - 
          ch_is_lower.m
          returns TRUE if a character is a lowercase alphabetic character;
        
 
        - 
          ch_is_printable.m
          determines if a character is printable;
        
 
        - 
          ch_is_space.m
          determines if a character is a "whitespace" character;
        
 
        - 
          ch_is_upper.m
          returns TRUE if a character is an uppercase alphabetic character;
        
 
        - 
          ch_low.m
          returns returns the lowercase version of a character;
        
 
        - 
          ch_roman_to_i4.m
          returns the integer value of a single digit of a Roman numeral;
        
 
        - 
          ch_scrabble.m
          returns the character on a given Scrabble tile;
        
 
        - 
          ch_scrabble_frequency.m
          returns the Scrabble frequency of a character;
        
 
        - 
          ch_scrabble_points.m
          returns the Scrabble point value of a character;
        
 
        - 
          ch_scrabble_select.m
          selects a character with the Scrabble probability;
        
 
        - 
          ch_swap.m
          swaps two characters;
        
 
        - 
          ch_to_amino_name.m
          converts a character to an amino acid name;
        
 
        - 
          ch_to_digit.m
          converts a character to a digit;
        
 
        - 
          ch_to_digit_bin.m
          converts a character to a binary digit;
        
 
        - 
          ch_to_digit_oct.m,
          converts a character to an octal digit;
        
 
        - 
          ch_to_ebcdic.m,
          converts a character to EBCDIC;
        
 
        - 
          ch_to_military.m,
          converts a character to its military encoding;
        
 
        - 
          ch_to_rot13.m,
          converts a character to its ROT13 encoding;
        
 
        - 
          ch_to_scrabble.m,
          returns the Scrabble index of a character;
        
 
        - 
          ch_to_soundex.m,
          converts an ASCII character to a Soundex character;
        
 
        - 
          ch_uniform.m,
          returns a random character in a given range;
        
 
        - 
          ch_wrap.m,
          forces a character to lie between given limits by wrapping.
        
 
        - 
          chvec_eq.m,
          is true if C1 == C2, for character vectors C1 and C2;
        
 
        - 
          chvec_lt.m,
          is true if C1 < C2, for character vectors C1 and C2;
        
 
        - 
          chvec_permute.m,
          permutes the entries of a character vector;
        
 
        - 
          chvec_print.m,
          prints the entries in a character vector;
        
 
        - 
          chvec_reverse.m,
          reverses the order of the entries in a character vector;
        
 
        - 
          chvec2_reverse.m,
          prints the entries in a pair of character vectors;
        
 
        - 
          degrees_to_radians.m,
          converts an angle from degrees to radians.
        
 
        - 
          digit_bin_to_ch.m,
          returns the character equivalent of a binary digit;
        
 
        - 
          digit_dec.m,
          decrements a decimal digit;
        
 
        - 
          digit_inc.m,
          increments a decimal digit;
        
 
        - 
          digit_oct_to_ch.m,
          returns the character equivalent of an octal digit;
        
 
        - 
          digit_to_ch.m,
          converts a digit to a character;
        
 
        - 
          file_name_inc.m,
          "increments" a file name;
        
 
        - 
          hex_digit_to_i4.m
          converts a hexadecimal digit to an I4;
        
 
        - 
          hex_to_binary_digits.m,
          converts a hexadecimal digit to binary digits;
        
 
        - 
          hex_to_binary_string.m,
          converts a hexadecimal string to a binary string.
        
 
        - 
          hex_to_i4.m,
          converts a hexadecimal string to an I4;
        
 
        - 
          i4_length.m,
          computes the number of characters needed to print an I4.
        
 
        - 
          i4_swap.m,
          swaps two integer values;
        
 
        - 
          i4_to_a.m,
          returns the I-th alphabetic character;
        
 
        - 
          i4_to_amino_code.m,
          converts an integer to an amino code.
          returns the I-th alphabetic character;
        
 
        - 
          i4_to_base.m
          converts an I4 to a representation in any base from 1 to 16.
        
 
        - 
          i4_to_binary.m
          produces the binary representation of an integer.
        
 
        - 
          i4_to_binhex.m
          returns the I-th character in the BINHEX encoding.
        
 
        - 
          i4_to_hex.m
          converts an I4 to a string of hexadecimal characters.
        
 
        - 
          i4_to_hex_digit.m,
          converts a (small) I4 to a hex digit.
        
 
        - 
          i4_to_isbn_digit.m,
          converts an I4 to an ISBN digit;
        
 
        - 
          i4_to_month_abb/a>
          returns the abbreviated (3 letter) I-th month name;
        
 
        - 
          i4_to_month_name.m
          returns the I-th month name;
        
 
        - 
          i4_to_nunary.m
          produces the "base -1" representation of an integer.
        
 
        - 
          i4_to_octal.m
          converts an I4 to a string of octal characters.
        
 
        - 
          i4_to_s_left.m
          converts an integer to a (left justified) string;
        
 
        - 
          i4_to_s_roman.m
          returns the Roman numeral representation of I;
        
 
        - 
          i4_to_s_zero.m
          converts an integer to a right-justified string padded with zeros;
        
 
        - 
          i4_to_s32.m
          converts an I4 to an S32.
        
 
        - 
          i4_to_unary.m,
          produces the "base 1" representation of an I4.
        
 
        - 
          i4_to_uudecode.m,
          returns the I-th character in the UUDECODE encoding.
        
 
        - 
          i4_to_xxdecode.m,
          returns the I-th character in the XXDECODE encoding.
        
 
        - 
          i4_uniform_ab.m,
          returns a random integer in a given range;
        
 
        - 
          i4_wrap.m,
          forces an integer to lie between given limits by wrapping.
        
 
        - 
          i4vec_print.m,
          prints an I4VEC.
        
 
        - 
          ic_to_ibraille.m,
          converts an ASCII integer code to a Braille code.
        
 
        - 
          ic_to_iebcdic.m,
          converts an ASCII character code to an EBCDIC code.
        
 
        - 
          ic_to_imorse.m,
          converts an ASCII character code to a Morse integer code.
        
 
        - 
          ic_to_isoundex.m,
          converts an ASCII integer code to a Soundex integer code.
        
 
        - 
          iebcdic_to_ic.m,
          converts an EBCDIC character code to ASCII.
        
 
        - 
          isbn_digit_to_i4.m,
          converts an ISBN digit to an I4.
        
 
        - 
          matlab_real_to_binary_string.m,
          converts a MATLAB real number to a binary string;
        
 
        - 
          matlab_real_to_hex_string.m,
          converts a MATLAB real number to a hexadecimal string;
        
 
        - 
          oct_to_i4.m,
          converts an octal string to an I4;
        
 
        - 
          r8_to_s_left.m,
          writes an R8 into a (left justified) string;
        
 
        - 
          r8_uniform_01.m,
          returns a unit pseudorandom R8.
        
 
        - 
          s_alpha_last.m,
          returns the location of the last alphabetic character in a string;
        
 
        - 
          s_adjustl.m,
          shifts a string to the left, "squeezing" out blanks;
        
 
        - 
          s_adjustr.m,
          shifts a string to the right, "squeezing" out blanks;
        
 
        - 
          s_begin.m,
          is TRUE if two strings match, up to the end of the shorter string,
          ignoring spaces and capitalization;
        
 
        - 
          s_behead_substring.m,
          removes the head of a string, if it matches a given substring;
        
 
        - 
          s_blank_delete.m,
          deletes every blank from a string;
        
 
        - 
          s_blanks_delete.m,
          replaces consecutive blanks by one blank in a string;
        
 
        - 
          s_cap.m,
          capitalizes all the characters in a string;
        
 
        - 
          s_cat.m,
          concatenates two strings;
        
 
        - 
          s_ch_delete.m,
          removes all occurrences of a character from a string.
        
 
        - 
          s_compare.m
          compares two strings, returning -1, 0, or +1.
        
 
        - 
          s_control_blank.m
          replaces control characters by blanks in a string.
        
 
        - 
          s_digits_count.m
          counts the decimal digits in a string.
        
 
        - 
          s_eqi.m,
          is TRUE if two strings are equal, ignoring case and trailing blanks;
        
 
        - 
          s_escape_tex.m,
          de-escapes TeX escape sequences;
        
 
        - 
          s_first_nonblank.m
          indexes the first nonblank character in a string;
        
 
        - 
          s_inc_c.m
          "increments" the characters in a string;
        
 
        - 
          s_index.m
          returns the index of the first occurrence of a substring in a string;
        
 
        - 
          s_is_alpha.m
          is TRUE if all characters in the string are alphabetic;
        
 
        - 
          s_len_trim.m
          returns the length of a string to the last nonblank;
        
 
        - 
          s_low.m
          makes a lowercase copy of a string;
        
 
        - 
          s_neqi.m
          is TRUE if two strings are not equal, ignoring case and trailing
          blanks;
        
 
        - 
          s_nonalpha_delete.m
          removes nonalphabetic characters from a string.
        
 
        - 
          s_quote.m
          quotes a string;
        
 
        - 
          s_replace_ch.m
          replaces all occurrences of one character by another;
        
 
        - 
          s_replace_ch_by_s.m
          replaces all occurrences of a character by a string;
        
 
        - 
          s_reverse.m
          reverses a string;
        
 
        - 
          s_s_subanagram.m
          determines if S2 is a "subanagram" of S1.
        
 
        - 
          s_s_subanagram_sorted.m
          determines if S2 is a "subanagram" of S1.
        
 
        - 
          
          s_substitute.m,
          substitutes characters in a string.
        
 
        - 
          s_scrabble_points.m
          determines the Scrabble value of a string.
        
 
        - 
          s_sort_a.m
          sorts a string into ascending order.
        
 
        - 
          s_swap.m
          swaps two strings;
        
 
        - 
          s_to_caesar.m
          applies a Caesar shift ciper to a string.
        
 
        - 
          s_to_digits.m
          extracts the decimal digits from a string.
        
 
        - 
          s_to_format.m
          converts a string to a Fortran format;
        
 
        - 
          s_to_i4.m
          converts a string to an integer;
        
 
        - 
          s_to_i4vec.m
          converts a string to an integer vector;
        
 
        - 
          s_to_isbn_digits.m
          extracts ISBN digits from a string.
        
 
        - 
          s_to_l4.m
          converts a string to a logical value;
        
 
        - 
          s_to_r8.m
          reads an R8 from a string;
        
 
        - 
          s_to_r8vec.m
          reads an R8VEC from a string;
        
 
        - 
          s_to_rot13.m
          encodes or decodes a string using ROT13;
        
 
        - 
          s_trim.m
          copies a string to the last nonblank;
        
 
        - 
          s_word_count.m
          counts the number of "words" in a string;
        
 
        - 
          s_word_extract_first.m
          extracts the first word from a string;
        
 
        - 
          sort_heap_external.m
          externally sorts a list of values into ascending order;
        
 
        - 
          timestamp.m
          prints the current YMDHMS date as a timestamp;
        
 
        - 
          vector_to_element.m
          converts a string representing a MATLAB function from
          vector to elementwise form.
        
 
        - 
          word_next_read.m
          reads words from a string, one at a time.
        
 
      
    
    
    
      Last revised on 06 August 2023.