StrAppendf
StrAppendf
Description
Print and append into given string object with given format.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in,out | Str to print into. |
fmt |
in | Format string, followed by variadic arguments. |
Success
str
Failure
NULL
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:32:
}
Str *StrAppendf(Str *str, const char *fmt, ...) {
ValidateStr(str);- In
Str.Insert.c:313:
// Test StrAppendf function
bool test_str_appendf(void) {
WriteFmt("Testing StrAppendf\n");
Str s = StrInitFromZstr("Hello");- In
Str.Insert.c:318:
// Append formatted string
StrAppendf(&s, " %s %d", "World", 2023);
// Check that the string was appended correctly
- In
JSON.h:705:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_OBJ(j, writer); \
} while (0)- In
JSON.h:771:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_ARR(j, arr, item, writer); \
} while (0)- In
JSON.h:792:
do { \
i64 my_int = (i); \
StrAppendf(&(j), "%lld", my_int); \
} while (0)- In
JSON.h:817:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_INT(j, i); \
} while (0)- In
JSON.h:838:
do { \
f64 my_flt = (f); \
StrAppendf(&(j), "%f", my_flt); \
} while (0)- In
JSON.h:863:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_FLT(j, f); \
} while (0)- In
JSON.h:883:
#define JW_STR(j, s) \
do { \
StrAppendf(&(j), "\"%s\"", (s).length ? (s).data : ""); \
} while (0)- In
JSON.h:908:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_STR(j, s); \
} while (0)- In
JSON.h:928:
#define JW_BOOL(j, b) \
do { \
StrAppendf(&(j), "%s", (b) ? "true" : "false"); \
} while (0)- In
JSON.h:953:
StrPushBack(&(j), ','); \
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_BOOL(j, b); \
} while (0)
Last updated on