From f3e4f8f061e144c6d6bf7e50e2c352f66928befb Mon Sep 17 00:00:00 2001 From: Timerix Date: Thu, 27 Nov 2025 01:23:41 +0500 Subject: [PATCH] added str_expand --- include/tlibc/string/str.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/tlibc/string/str.h b/include/tlibc/string/str.h index cc10f92..bad3717 100755 --- a/include/tlibc/string/str.h +++ b/include/tlibc/string/str.h @@ -13,7 +13,13 @@ typedef struct str { bool isZeroTerminated; } str; +/* +USAGE: +str s = STR("something"); +printf(FMT_str"\n", str_expand(s)); +*/ #define FMT_str "%.*s" +#define str_expand(s) s.len, s.data /// creates str from a string literal #define STR(LITERAL) str_construct(LITERAL, ARRAY_LEN(LITERAL) - 1, true)