diff options
-rw-r--r-- | AK/FlyString.h | 5 | ||||
-rw-r--r-- | AK/String.h | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/AK/FlyString.h b/AK/FlyString.h index 71631024f1..39ff80a730 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -69,6 +69,11 @@ struct Formatter<FlyString> : Formatter<StringView> { } +[[nodiscard]] ALWAYS_INLINE AK::ErrorOr<AK::FlyString> operator""_fly_string(char const* cstring, size_t length) +{ + return AK::FlyString::from_utf8(AK::StringView(cstring, length)); +} + #if USING_AK_GLOBALLY using AK::FlyString; #endif diff --git a/AK/String.h b/AK/String.h index f9d6ec48a6..de54de1e5d 100644 --- a/AK/String.h +++ b/AK/String.h @@ -259,3 +259,13 @@ struct Formatter<String> : Formatter<StringView> { }; } + +[[nodiscard]] ALWAYS_INLINE AK::ErrorOr<AK::String> operator""_string(char const* cstring, size_t length) +{ + return AK::String::from_utf8(AK::StringView(cstring, length)); +} + +[[nodiscard]] ALWAYS_INLINE consteval AK::String operator""_short_string(char const* cstring, size_t length) +{ + return AK::String::from_utf8_short_string(AK::StringView(cstring, length)); +} |