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