Go to the documentation of this file.
40 size_t len, fromlen, tolen;
43 fromlen = strlen(fromlist);
44 tolen = strlen(tolist);
47 for (k=0; k<fromlen; k++) {
48 if (
str[
i] == fromlist[k]) {
98 int j, rc, flags, global, nmatches;
112 if ((rc =
regcomp(&re, pattern, flags)) != 0) {
114 *new_str = gk_cmalloc(
len,
"gk_strstr_replace: new_str");
123 *new_str = gk_cmalloc(nlen+1,
"gk_strstr_replace: new_str");
127 rlen = strlen(replacement);
135 *new_str =
gk_strdup(
"regexec ran out of memory.");
142 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
153 if (nlen-noffset <
matches[0].rm_so) {
154 nlen +=
matches[0].rm_so - (nlen-noffset);
155 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
162 for (
i=0;
i<rlen;
i++) {
163 switch (replacement[
i]) {
166 if (nlen-noffset < 1) {
168 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
170 *new_str[noffset++] = replacement[++
i];
174 *new_str =
gk_strdup(
"Error in replacement string. Missing character following '\'.");
182 j = (
int)(replacement[++
i] -
'0');
183 if (j < 0 || j > 9) {
185 *new_str =
gk_strdup(
"Error in captured subexpression specification.");
192 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
200 *new_str =
gk_strdup(
"Error in replacement string. Missing subexpression number folloing '$'.");
207 if (nlen-noffset < 1) {
209 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
211 (*new_str)[noffset++] = replacement[
i];
222 *new_str = (
char *)
gk_realloc(*new_str, (nlen+1)*
sizeof(char),
"gk_strstr_replace: new_str");
230 (*new_str)[noffset] =
'\0';
259 len = strlen(rmlist);
261 for (
i=strlen(
str)-1;
i>=0;
i--) {
263 if (
str[
i] == rmlist[
j])
296 len = strlen(rmlist);
300 if (
str[
i] == rmlist[
j])
377 if (orgstr !=
NULL) {
378 len = strlen(orgstr)+1;
409 if (strlen(s1) != strlen(s2))
412 while (s1[
i] !=
'\0') {
413 if (tolower(s1[
i]) != tolower(s2[
i]))
435 int i1 = strlen(s1)-1;
436 int i2 = strlen(s2)-1;
438 while ((
i1 >= 0) && (i2 >= 0)) {
439 if (s1[
i1] != s2[i2])
440 return (s1[
i1] - s2[i2]);
472 static char datestr[128];
475 tm = localtime(&
time);
477 if (strftime(datestr, 128,
"%m/%d/%Y %H:%M:%S", tm) == 0)
485 #if !defined(WIN32) && !defined(__MINGW32__)
506 if (strptime(
str,
"%m/%d/%Y %H:%M:%S", &
time) ==
NULL)
523 for (
i=0; strmap[
i].
name;
i++) {
Annotation for function names.
int gk_GetStringID(gk_StringMap_t *strmap, char *key)
char * gk_strtoupper(char *str)
Converts a string to upper case.
void gk_free(void **ptr1,...)
size_t regerror(int __errcode, const regex_t *__restrict __preg, char *__restrict __errbuf, size_t __errbuf_size)
char * gk_time2str(time_t time)
Converts a time_t time into a string.
time_t gk_str2time(char *str)
Converts a date/time string into its equivalent time_t value.
int gk_strstr_replace(char *str, char *pattern, char *replacement, char *options, char **new_str)
Regex-based search-and-replace function.
int gk_strcasecmp(char *s1, char *s2)
Case insensitive string comparison.
void * gk_realloc(void *oldptr, size_t nbytes, char *msg)
int gk_strrcmp(char *s1, char *s2)
Compare two strings in revere order.
char * gk_strtolower(char *str)
Converts a string to lower case.
int regexec(const regex_t *__restrict __preg, const char *__restrict __string, size_t __nmatch, regmatch_t __pmatch[__restrict_arr], int __eflags)
char * gk_strdup(char *orgstr)
Duplicates a string.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
const gtsam::Symbol key('X', 0)
char * gk_strtprune(char *str, char *rmlist)
Prunes characters from the end of the string.
int regcomp(regex_t *__restrict __preg, const char *__restrict __pattern, int __cflags)
char * gk_strchr_replace(char *str, char *fromlist, char *tolist)
Replaces certain characters in a string.
size_t len(handle h)
Get the length of a Python object.
void * gk_malloc(size_t nbytes, char *msg)
char * gk_strhprune(char *str, char *rmlist)
Prunes characters from the beginning of the string.
void regfree(regex_t *__preg)
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:14:04