Functions | |
TRIO_STRING_PUBLIC char * | trio_create (size_t size) |
Create new string. More... | |
TRIO_STRING_PUBLIC void | trio_destroy (char *string) |
Destroy string. More... | |
TRIO_STRING_PUBLIC size_t | trio_length (const char *string) |
Count the number of characters in a string. More... | |
TRIO_STRING_PUBLIC int | trio_append (char *target, const char *source) |
Append source at the end of target . More... | |
TRIO_STRING_PUBLIC int | trio_append_max (char *target, size_t max, const char *source) |
Append at most max characters from source to target . More... | |
TRIO_STRING_PUBLIC int | trio_contains (const char *string, const char *substring) |
Determine if a string contains a substring. More... | |
TRIO_STRING_PUBLIC int | trio_copy (char *target, const char *source) |
Copy source to target . More... | |
TRIO_STRING_PUBLIC int | trio_copy_max (char *target, size_t max, const char *source) |
Copy at most max characters from source to target . More... | |
TRIO_STRING_PUBLIC char * | trio_duplicate (const char *source) |
Duplicate source . More... | |
TRIO_STRING_PUBLIC char * | trio_duplicate_max (const char *source, size_t max) |
Duplicate at most max characters of source . More... | |
TRIO_STRING_PUBLIC int | trio_equal (const char *first, const char *second) |
Compare if two strings are equal. More... | |
TRIO_STRING_PUBLIC int | trio_equal_case (const char *first, const char *second) |
Compare if two strings are equal. More... | |
TRIO_STRING_PUBLIC int | trio_equal_case_max (const char *first, size_t max, const char *second) |
Compare if two strings up until the first max characters are equal. More... | |
TRIO_STRING_PUBLIC int | trio_equal_locale (const char *first, const char *second) |
Compare if two strings are equal. More... | |
TRIO_STRING_PUBLIC int | trio_equal_max (const char *first, size_t max, const char *second) |
Compare if two strings up until the first max characters are equal. More... | |
TRIO_STRING_PUBLIC const char * | trio_error (int error_number) |
Provide a textual description of an error code (errno). More... | |
TRIO_STRING_PUBLIC size_t | trio_format_date_max (char *target, size_t max, const char *format, const struct tm *datetime) |
Format the date/time according to format . More... | |
TRIO_STRING_PUBLIC unsigned long | trio_hash (const char *string, int type) |
Calculate a hash value for a string. More... | |
TRIO_STRING_PUBLIC char * | trio_index (const char *string, int character) |
Find first occurrence of a character in a string. More... | |
TRIO_STRING_PUBLIC char * | trio_index_last (const char *string, int character) |
Find last occurrence of a character in a string. More... | |
TRIO_STRING_PUBLIC int | trio_lower (char *target) |
Convert the alphabetic letters in the string to lower-case. More... | |
TRIO_STRING_PUBLIC int | trio_match (const char *string, const char *pattern) |
Compare two strings using wildcards. More... | |
TRIO_STRING_PUBLIC int | trio_match_case (const char *string, const char *pattern) |
Compare two strings using wildcards. More... | |
TRIO_STRING_PUBLIC size_t | trio_span_function (char *target, const char *source, int(*Function)(int)) |
Execute a function on each character in string. More... | |
TRIO_STRING_PUBLIC char * | trio_substring (const char *string, const char *substring) |
Search for a substring in a string. More... | |
TRIO_STRING_PUBLIC char * | trio_substring_max (const char *string, size_t max, const char *substring) |
Search for a substring in the first max characters of a string. More... | |
TRIO_STRING_PUBLIC char * | trio_tokenize (char *string, const char *delimiters) |
Tokenize string. More... | |
TRIO_STRING_PUBLIC trio_long_double_t | trio_to_long_double (const char *source, char **endp) |
Convert string to floating-point number. More... | |
TRIO_STRING_PUBLIC double | trio_to_double (const char *source, char **endp) |
Convert string to floating-point number. More... | |
TRIO_STRING_PUBLIC float | trio_to_float (const char *source, char **endp) |
Convert string to floating-point number. More... | |
TRIO_STRING_PUBLIC long | trio_to_long (const char *string, char **endp, int base) |
Convert string to signed integer. More... | |
TRIO_STRING_PUBLIC unsigned long | trio_to_unsigned_long (const char *string, char **endp, int base) |
Convert string to unsigned integer. More... | |
TRIO_STRING_PUBLIC int | trio_upper (char *target) |
Convert the alphabetic letters in the string to upper-case. More... |
SYNOPSIS
cc ... -ltrio -lm #include <triostr.h>
DESCRIPTION
This package renames, fixes, and extends the standard C string handling functions.
Naming
Renaming is done to provide more clear names, to provide a consistant naming and argument policy, and to hide portability issues.
Fixing is done to avoid subtle error conditions. For example, strncpy
does not terminate the result with a zero if the source string is bigger than the maximal length, so technically the result is not a C string anymore. trio_copy_max makes sure that the result is zero terminated.
Extending
Extending is done to provide a richer set of fundamental functions. This includes functionality such as wildcard matching ( trio_match
) and calculation of hash values ( trio_hash
).
|
Append
|
|
Append at most
|
|
Determine if a string contains a substring.
|
|
Copy
|
|
Copy at most
|
|
Create new string.
|
|
Destroy string.
|
|
Duplicate
|
|
Duplicate at most
|
|
Compare if two strings are equal.
|
|
Compare if two strings are equal.
|
|
Compare if two strings up until the first
|
|
Compare if two strings are equal.
|
|
Compare if two strings up until the first
|
|
Provide a textual description of an error code (errno).
|
|
Format the date/time according to
|
|
Calculate a hash value for a string.
type can be one of the following
|
|
Find first occurrence of a character in a string.
|
|
Find last occurrence of a character in a string.
|
|
Count the number of characters in a string.
|
|
Convert the alphabetic letters in the string to lower-case.
|
|
Compare two strings using wildcards.
The following wildcards can be used
|
|
Compare two strings using wildcards.
The following wildcards can be used
|
|
Execute a function on each character in string.
|
|
Search for a substring in a string.
|
|
Search for a substring in the first
|
|
Convert string to floating-point number.
|
|
Convert string to floating-point number.
|
|
Convert string to signed integer.
|
|
Convert string to floating-point number.
double ::= [ <sign> ] ( <number> | <number> <decimal_point> <number> | <decimal_point> <number> ) [ <exponential> [ <sign> ] <number> ] number ::= 1*( <digit> ) digit ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ) exponential ::= ( 'e' | 'E' ) sign ::= ( '-' | '+' ) decimal_point ::= '.' |
|
Convert string to unsigned integer.
|
|
Tokenize string.
|
|
Convert the alphabetic letters in the string to upper-case.
|