plibsys 0.0.5
|
String manipulation routines. More...
Go to the source code of this file.
Functions | |
P_LIB_API pchar * | p_strdup (const pchar *str) |
Copies a string. | |
P_LIB_API pchar * | p_strchomp (const pchar *str) |
Removes trailing and leading whitespaces. | |
P_LIB_API pchar * | p_strtok (pchar *str, const pchar *delim, pchar **buf) |
Tokenizes a string by given delimiters. | |
P_LIB_API double | p_strtod (const pchar *str) |
Converts a string to double without a locale dependency. | |
String manipulation routines.
Strings are represented as a sequence of single-byte characters (from the ASCII table) with the trailing zero character (\0).
Some useful string manipulation routines are represented here.
Definition in file pstring.h.
Removes trailing and leading whitespaces.
str | String with the trailing zero to process. |
Copies a string.
str | String with the trailing zero to copy. |
Converts a string to double without a locale dependency.
str | String to convert. |
Since the atof() system call is locale dependent, you can use this call to convert string variables to double values. The decimal point is '.' as in the 'C' locale.
Tokenizes a string by given delimiters.
[in,out] | str | String to tokenize. |
delim | List of delimiters to split the string. | |
buf | Context to store tokenize info. |
The common usage of this call is following:
Take attention that you need to pass the original string only once, after that you should pass NULL instead. You can also pass different delimiters each time.
Some platforms do not support the third parameter and it can be remained unused. In that case this call wouldn't be thread-safe.