GRASS Programmer's Manual  6.4.1(2011)
index.c
Go to the documentation of this file.
00001 /* TODO: should this go into strings.c ? */
00002 
00003 #include <grass/gis.h>
00004 
00005 
00016 char *G_index(const char *str, int delim)
00017 {
00018     while (*str && *str != delim)
00019         str++;
00020     if (delim == 0)
00021         return (char *)str;
00022     return *str ? (char *)str : NULL;
00023 }
00024 
00025 
00036 char *G_rindex(const char *str, int delim)
00037 {
00038     const char *p;
00039 
00040     p = NULL;
00041     while (*str) {
00042         if (*str == delim)
00043             p = str;
00044         str++;
00045     }
00046     if (delim == 0)
00047         return (char *)str;
00048     return (char *)p;
00049 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines