52 double sb_strtod(
const char *s00,
char **se);
57 return sb_strtod(str, NULL);
64 if (ch ==
' ' || ch ==
'\t' || ch ==
'\n' || ch ==
'\r')
79 while ((c = va_arg(args,
const char *)) != NULL) {
88 while ((c = va_arg(args,
const char *)) != NULL) {
101 len = strlen(
string);
103 size_t sub = strspn(
string,
" \t\n\r\f");
105 memmove(
string,
string + sub, len + 1 - sub);
112 if (strchr(
" \t\n\r\f",
string[sub]) == NULL)
117 string[sub+1] =
'\0';
131 while (line[i] && isspace_c(line[i]))
136 if (ptr != NULL && n >= max_ptr) {
152 while (line[i] && !isspace_c(line[i]))
166 nextword(
char *line,
const char *delim,
char **word,
char *delimfound)
172 for (w = line; *w; w++) {
173 for (d = delim; *d && (*d != *w); d++);
184 for (d = delim; *d && (*d != *w); d++);
Miscellaneous useful string functions.
#define ckd_calloc(n, sz)
Macros to simplify the use of above functions.
Sphinx's memory allocation/deallocation routines.
SPHINXBASE_EXPORT double atof_c(char const *str)
Locale independent version of atof().
SPHINXBASE_EXPORT int32 str2words(char *line, char **wptr, int32 n_wptr)
Convert a line to an array of "words", based on whitespace separators.
SPHINXBASE_EXPORT char * string_join(const char *base,...)
Concatenate a NULL-terminated argument list of strings, returning a newly allocated string...
SPHINXBASE_EXPORT int32 nextword(char *line, const char *delim, char **word, char *delimfound)
Yet another attempt at a clean "next-word-in-string" function.
SPHINXBASE_EXPORT char * string_trim(char *string, enum string_edge_e which)
Remove whitespace from a string, modifying it in-place.
string_edge_e
Which end of a string to operate on for string_trim().