GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
case.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_base/case.c
3 
4  \brief DBMI Library (base) - case string conversion
5 
6  (C) 1999-2009, 2011 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Joel Jones (CERL/UIUC), Radim Blazek
12  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
13 */
14 
15 #include <grass/dbmi.h>
16 
17 /*!
18  \brief Convert character to lowercase
19 
20  \param s character to be modified
21 */
22 void db_char_to_lowercase(char *s)
23 {
24  if (*s >= 'A' && *s <= 'Z')
25  *s -= 'A' - 'a';
26 }
27 
28 /*!
29  \brief Convert character to uppercase
30 
31  \param s character to be modified
32  */
33 void db_char_to_uppercase(char *s)
34 {
35  if (*s >= 'a' && *s <= 'z')
36  *s += 'A' - 'a';
37 }
38 
39 /*!
40  \brief Convert string to lowercase
41 
42  \param s string buffer to be modified
43 */
45 {
46  while (*s)
48 }
49 
50 /*!
51  \brief Convert string to lowercase
52 
53  \param s string buffer to be modified
54 */
56 {
57  while (*s)
59 }
60 
61 /*!
62  \brief Compare strings case-insensitive
63 
64  \param a,b string buffers to be compared
65 
66  \return 0 strings equal
67  \return 1 otherwise
68  */
69 int db_nocase_compare(const char *a, const char *b)
70 {
71  char s, t;
72 
73  while (*a && *b) {
74  s = *a++;
75  t = *b++;
78  if (s != t)
79  return 0;
80  }
81  return (*a == 0 && *b == 0);
82 }
void db_Cstring_to_lowercase(char *s)
Convert string to lowercase.
Definition: case.c:44
int db_nocase_compare(const char *a, const char *b)
Compare strings case-insensitive.
Definition: case.c:69
double t
Definition: r_raster.c:39
double b
Definition: r_raster.c:39
void db_Cstring_to_uppercase(char *s)
Convert string to lowercase.
Definition: case.c:55
void db_char_to_uppercase(char *s)
Convert character to uppercase.
Definition: case.c:33
void db_char_to_lowercase(char *s)
Convert character to lowercase.
Definition: case.c:22