added str_expand
This commit is contained in:
parent
83091ac707
commit
f3e4f8f061
@ -13,7 +13,13 @@ typedef struct str {
|
|||||||
bool isZeroTerminated;
|
bool isZeroTerminated;
|
||||||
} str;
|
} str;
|
||||||
|
|
||||||
|
/*
|
||||||
|
USAGE:
|
||||||
|
str s = STR("something");
|
||||||
|
printf(FMT_str"\n", str_expand(s));
|
||||||
|
*/
|
||||||
#define FMT_str "%.*s"
|
#define FMT_str "%.*s"
|
||||||
|
#define str_expand(s) s.len, s.data
|
||||||
|
|
||||||
/// creates str from a string literal
|
/// creates str from a string literal
|
||||||
#define STR(LITERAL) str_construct(LITERAL, ARRAY_LEN(LITERAL) - 1, true)
|
#define STR(LITERAL) str_construct(LITERAL, ARRAY_LEN(LITERAL) - 1, true)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user