22 #include <sys/types.h>
23 #include <grass/gis.h>
29 static char *G_strend(
const char *S)
50 while ((*d++ = *F++)) ;
203 if (xx >=
'A' && xx <=
'Z')
205 if (yy >=
'A' && yy <=
'Z')
230 char *
G_strstr(
const char *mainString,
const char *subString)
238 length = strlen(subString);
241 while (*q !=
'\0' && *q != *p) {
244 }
while (*q !=
'\0' && strncmp(p, q, length) != 0 && q++);
269 p = G_malloc(strlen(
string) + 1);
287 char *
G_strchg(
char *bug,
char character,
char new)
292 if (*help == character)
325 if (old_str ==
NULL || new_str ==
NULL)
332 B = strstr(buffer, old_str);
337 if (strlen(new_str) > strlen(old_str)) {
340 len = strlen(old_str);
342 while (B !=
NULL && *B !=
'\0') {
350 len = count * (strlen(new_str) - strlen(old_str))
355 len = strlen(buffer);
358 replace = G_malloc(len + 1);
365 len = strlen(old_str);
367 if (*B == old_str[0] && strncmp(B, old_str, len) == 0) {
391 register char *a, *
b;
394 for (a = b = buf; *a ==
' ' || *a ==
'\t'; a++) ;
396 while ((*b++ = *a++)) ;
398 for (a = buf; *a; a++) ;
400 for (a--; *a ==
' ' || *a ==
'\t'; a--) ;
420 register char *f = line, *t = line;
430 for (t = line; *t; t++)
432 while (isspace(*--t)) ;
456 str[i] = toupper(str[i]);
474 str[i] = tolower(str[i]);
500 if (!(*c >=
'A' && *c <=
'Z') && !(*c >=
'a' && *c <=
'z') &&
501 !(*c >=
'0' && *c <=
'9')) {
509 if (!(*c >=
'A' && *c <=
'Z') && !(*c >=
'a' && *c <=
'z')) {
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower)
char * G_chrcat(char *T, const char *F, int n)
This function is like G_strcat() except that not more than n characters from F are appended to the en...
char * G_strcat(char *T, const char *F)
This copies characters from the string F into the string T.
char * G_chrcpy(char *T, const char *F, int n)
Copies characters from the string F into the string T.
char * G_strdup(const char *string)
Copies the null-terminated string into a newly allocated string. The string is allocated using G_mall...
char * G_strchg(char *bug, char character, char new)
Replace all occurencies of character in string bug with new.
char * G_chop(char *line)
Chop leading and trailing white spaces:
char * G_strcpy(char *T, const char *F)
Copies characters from the string F into the string T.
void G_str_to_lower(char *str)
Convert string to lower case.
char * G_str_replace(char *buffer, const char *old_str, const char *new_str)
Replace all occurencies of old_str in buffer with new_str.
int G_strip(char *buf)
Removes all leading and trailing white space from string.
char * G_strncpy(char *T, const char *F, int n)
This function is similar to G_chrcpy() but always copies at least n characters into the string T...
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
char * G_strstr(const char *mainString, const char *subString)
Finds the first occurrence of the character C in the null-terminated string beginning at mainString...
char * G_strmov(char *T, const char *F)
Copies characters from the string F (not including the terminating null character) into the string T...
char * G_chrmov(char *T, const char *F, int n)
This copies characters from the string F (exactly n characters) into the string T.
void G_str_to_upper(char *str)
Convert string to upper case.
int G_str_to_sql(char *str)
Make string SQL compliant.