1 #include <grass/gis.h>
2 /*
3 * Map uppercase A-Z to lower case a-z
4 *
5 */
6
7
8 /*!
9 * \brief convert string to lower case
10 *
11 * Upper case
12 * letters in the string <b>s</b> are converted to their lower case equivalent.
13 * Returns <b>s.</b>
14 *
15 * \param string
16 * \return char
17 */
18
G_tolcase(char * string)19 char *G_tolcase(char *string)
20 {
21 char *p;
22
23 for (p = string; *p; p++) {
24 /* convert to lower case */
25 if (*p >= 'A' && *p <= 'Z')
26 *p -= 'A' - 'a';
27 }
28
29 return (string);
30 }
31
32
33 /*
34 * Map lowercase a-z to uppercase A-Z
35 *
36 */
37
38
39 /*!
40 * \brief convert string to upper case
41 *
42 * Lower case letters in the string <b>s</b> are converted to their upper case equivalent.
43 * Returns <b>s.</b>
44 *
45 * \param string
46 * \return char
47 */
48
G_toucase(char * string)49 char *G_toucase(char *string)
50 {
51 char *p;
52
53 for (p = string; *p; p++) {
54 /* convert to upper case */
55 if (*p >= 'A' && *p <= 'z')
56 *p += 'A' - 'a';
57 }
58
59 return (string);
60 }
61