diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.cpp b/Userland/Libraries/LibUnicode/CharacterTypes.cpp index e96e263447c..6bb304dcedb 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.cpp +++ b/Userland/Libraries/LibUnicode/CharacterTypes.cpp @@ -108,6 +108,11 @@ bool code_point_has_general_category(u32 code_point, GeneralCategory general_cat return u_charType(icu_code_point) == icu_general_category; } +bool code_point_is_printable(u32 code_point) +{ + return static_cast(u_isprint(static_cast(code_point))); +} + bool code_point_has_control_general_category(u32 code_point) { return code_point_has_general_category(code_point, U_CONTROL_CHAR); diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.h b/Userland/Libraries/LibUnicode/CharacterTypes.h index 84dc8b6992a..c16ee908599 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.h +++ b/Userland/Libraries/LibUnicode/CharacterTypes.h @@ -17,6 +17,7 @@ namespace Unicode { Optional general_category_from_string(StringView); bool code_point_has_general_category(u32 code_point, GeneralCategory general_category); +bool code_point_is_printable(u32 code_point); bool code_point_has_control_general_category(u32 code_point); bool code_point_has_letter_general_category(u32 code_point); bool code_point_has_number_general_category(u32 code_point);