The following functions deal with upper- and lowercase conversions of one or more characters: st_toupper(), st_tolower(), ch_toupper(), and ch_tolower(). The functions ch_isupper() and ch_islower() test if a given character is upper- or lowercase.
All 6 of these functions use the functions supplied by the compiler in converting or determining character case for characters in the ASCII range 0 to 127.
Case conversion for characters in the extended character set (128 to 255) is determined by the case conversion table defined in the header file vv_main.h. This case conversion table is in use only if the header file vv_extch.h is included in your program.
The case conversion table in vv_main.h lists a character conversion structure for each ASCII character code from 128 to 255. The first member of the structure lists the ASCII code for the opposite case of the character and the second member of the structure lists the character's type.
For example, the line for character 128 reads as follows:
|
This means that character 128 ('Ç') is an alphabetic character and is an upper case character. Its lowercase is character 135 ('ç').
The line in the case conversion table for character 131 reads:
|
This means that character 131 ('â') is an alphabetic, lowercase character. Its uppercase character is an 'A'.
Characters that are graphic characters are described with type CH_GRAPHIC. The opposite case for graphic characters is itself, for example:
|
Characters that are symbols are often considered both upper- and lowercase characters. The opposite case character for a symbol is often itself.
The default case conversions are listed in the Function Reference. These conversions are made to the best of our knowledge of the international character set. Feel free to change the table.
Table 49.1: String Utilities
| To do this: | Use this function: |
| Delete a character at a location in a string | st_delch(stp, location) |
| Delete an embedded blank in a string | st_delembwh(stp) |
| Strip a trailing blank from a string | st_delendwh(stp) |
| Extract a substring from a string | st_extract(Dest_stp, source_stp, location, chq) |
| Convert an integer into its string representation | st_frint(int_value, stp) |
| Convert a long integer into its string representation | st_frlong(long_val, stp) |
| Convert a short integer into its string representation | st_frshort(short_val, stp) |
| Insert a string in a destination string at a specified location | st_ins(stp, dest_stp, location) |
| Insert a number of characters in a string (including a blank space) | st_insch(ch, q, stp, location) |
| Check if a string is blank | st_isblank(stp) |
| Shift a string left by a specified number of positions | st_lft(stp, location, posq) |
| Left justify a string by removing leading blanks | st_lftadj(stp) |
| Pad a string with blanks to extend it to a specified length | st_padblank(stp, len) |
| Read a string from an ASCII file | st_rd(filep, stp, q, break_ch, tabq) |
| Reverse the order of characters in a string | st_rev(stp) |
| Shift a string right by a specified number of positions | st_rt(stp, location, posq) |
| Right justify a string by removing leading blanks | st_rtadj(stp) |
| Convert each character in a string to lowercase | st_tolower(stp) |
| Convert a string representation of a short integer into a short integer value | st_toshort(stp) |
| Convert each character in a string to uppercase | st_toupper(stp) |
| Write a string to an ASCII disk file | st_wr(filep, stp) |
| Find the first non-whitespace character in a string | stp_begtxt(stp) |
| Find the last non-blank character in a string | stp_endtxt(stp) |
| Search for a sub-string within a string | stp_find(stp, sub-stp) |
| Find the last non-blank character in a string | (stp) |
| Search for a sub-string within a string | (stp, sub-stp) |
Table 49.2: Character Utilities
| To do this: | Use this function: |
| Determine if a character is alphabetic | ch_isalpha(ch) |
| Determine if a character is a digit | ch_isdigit(ch) |
| Determine if a character is lowercase | ch_islower(ch) |
| Determine if a character is a space | ch_isspace(ch) |
| Determine if a character is a text character | ch_istxt(ch) |
| Determine if a character is uppercase | ch_isupper(ch) |
| Convert a character to lowercase | ch_tolower(ch) |
| Convert a character to uppercase | ch_toupper(ch) |