From c596882c32d18a01bfa467500ae3e87122f3d300 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Fri, 3 Jan 2025 01:14:09 +0800 Subject: [PATCH] feat(strings): add TChar::IsValid() support for char type --- Redcraft.Utility/Source/Public/Strings/Char.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Redcraft.Utility/Source/Public/Strings/Char.h b/Redcraft.Utility/Source/Public/Strings/Char.h index 9b9fcf6..b53e9f3 100644 --- a/Redcraft.Utility/Source/Public/Strings/Char.h +++ b/Redcraft.Utility/Source/Public/Strings/Char.h @@ -85,7 +85,14 @@ struct TChar NODISCARD FORCEINLINE static constexpr bool IsValid(FCharType InChar) { - if constexpr (CSameAs) + if constexpr (TChar::IsASCII() && CSameAs) + { + if (0x00 <= InChar && InChar <= 0x7F) return true; + + return false; + } + + else if constexpr (CSameAs) { if ((InChar & 0b10000000) == 0b00000000) return true;