summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-31 08:29:53 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-31 17:50:54 +0000
commit94a346c9b9e34a0c6ae20a2e6877e9a5ce8f1296 (patch)
tree85073dcc85c23b80c24b4429524132bf28472cac
parent001322737700b19e0ce17c6d1c3941ef02f7dace (diff)
downloadserenity-94a346c9b9e34a0c6ae20a2e6877e9a5ce8f1296.zip
AK: Add is_ascii_[binary,octal]_digit to CharacterTypes
-rw-r--r--AK/CharacterTypes.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/AK/CharacterTypes.h b/AK/CharacterTypes.h
index 76fed39933..d4cdc6d6f1 100644
--- a/AK/CharacterTypes.h
+++ b/AK/CharacterTypes.h
@@ -44,6 +44,16 @@ constexpr bool is_ascii_alphanumeric(u32 code_point)
return is_ascii_alpha(code_point) || is_ascii_digit(code_point);
}
+constexpr bool is_ascii_binary_digit(u32 code_point)
+{
+ return code_point == '0' || code_point == '1';
+}
+
+constexpr bool is_ascii_octal_digit(u32 code_point)
+{
+ return code_point >= '0' && code_point <= '7';
+}
+
constexpr bool is_ascii_hex_digit(u32 code_point)
{
return is_ascii_digit(code_point) || (code_point >= 'A' && code_point <= 'F') || (code_point >= 'a' && code_point <= 'f');
@@ -164,6 +174,7 @@ constexpr u32 to_ascii_base36_digit(u32 digit)
using AK::is_ascii;
using AK::is_ascii_alpha;
using AK::is_ascii_alphanumeric;
+using AK::is_ascii_binary_digit;
using AK::is_ascii_blank;
using AK::is_ascii_c0_control;
using AK::is_ascii_control;
@@ -171,6 +182,7 @@ using AK::is_ascii_digit;
using AK::is_ascii_graphical;
using AK::is_ascii_hex_digit;
using AK::is_ascii_lower_alpha;
+using AK::is_ascii_octal_digit;
using AK::is_ascii_printable;
using AK::is_ascii_punctuation;
using AK::is_ascii_space;