[GRASS5] Re: G_index, G_strstr, G_trim_decimal
Andreas Lange
Andreas.Lange at Rhein-Main.de
Thu Jun 8 16:07:03 EDT 2000
Hi developers, hi Markus,
Markus Neteler wrote:
> I found:
> src/libes/gis/trim_dec.c
>
> int G_trim_decimal (char *buf)
> /* this routine remove trailing zeros from decimal number
> * for example: 23.45000 would come back as 23.45
> */
exactly what i was looking for...
> src/libes/gis/index.c
> char *
> G_index (str, delim)
>
> -> mhh, is it comparing str and delimiter?
>
> char *
> G_rindex (str, delim)
>
> -> what's this?
as Michel noted, these functions are adapted from BSD libs for string
manipulation.
Hopefully they are implemented as described in the man section.
> src/libes/gis/string.c
> * string/chring movement functions
> * G_strcpy (T, F) copy F up to null, copy null
> * G_strncpy (T, F, n) copy F up to null or n, always copy null
> * G_chrcpy (T, F, n) copy F up to n, copy null
> *
> * G_strmov (T, F) copy F up to null
> * G_chrmov (T, F, n) copy F up to n
> *
> * G_strcat (T, F) cat F up to null, copy null
> * G_chrcat (T, F, n) cat F up to n, copy null
> * the -cpy and -cat functions are for null-terminated destinations;
> * the -mov functions are for non-null-terminated ('chring') destinations.
> * all functions return 'T'.
>
> * G_strcasecmp(a, b) char *a, *b;
> * string compare ignoring case (upper or lower)
> * returns: -1 a<b; 0 a==b; 1 a>
>
> * G_strstr(mainString, subString)
> * Return a pointer to the first occurrence of subString
> * in mainString, or NULL if no occurrences are found.
>
> * G_strdup(string)
> * Return a pointer to a string that is a duplicate of the string
> * given to G_strdup. The duplicate is created using malloc.
> * If unable to allocate the required space, NULL is returned.
>
> src/libes/gis/chop.c
> * G_chop - chop leading and trailing white spaces:
> * space, \f, \n, \r, \t, \v
> * - returns pointer to string
> *
> * char *G_chop (char *s)
> *
> * modified copy of G_squeeze(); RB March 2000
> * <Radim.Blazek at dhv.cz>
I was looking for _portable_ functions for that. Very nice that they are
included in GRASS.
Some of those functions are re-implemented in certain modules again, i
already removed them in the CC and in one file of the gis library.
> ----------------
> Shall I include a "utility" section within the programmer's manual?
> Where to place these information?
The G_squeeze etc. functions are described in a "Miscallanous" Section
of the programming manual. But a "String Manipulation" chapter would be
more precise i think.
cu,
Andreas
--
Andreas Lange, 65187 Wiesbaden, Germany, Tel. +49 611 807850
Andreas.Lange at Rhein-Main.de, A.C.Lange at GMX.net
----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'
More information about the grass-dev
mailing list