1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:27:35 +00:00

AK: Add CharacterTypes::is_ascii_base36_digit()

This can be used to validate the string passed to
`parse_ascii_base36_digit()`.
This commit is contained in:
Tim Ledbetter 2024-01-12 21:34:22 +00:00 committed by Andrew Kaster
parent bbdbd71439
commit 65827826fe
2 changed files with 17 additions and 0 deletions

View file

@ -45,6 +45,11 @@ constexpr bool is_ascii_alphanumeric(u32 code_point)
return is_ascii_alpha(code_point) || is_ascii_digit(code_point);
}
constexpr bool is_ascii_base36_digit(u32 code_point)
{
return is_ascii_digit(code_point) || (code_point >= 'A' && code_point <= 'Z') || (code_point >= 'a' && code_point <= 'z');
}
constexpr bool is_ascii_binary_digit(u32 code_point)
{
return code_point == '0' || code_point == '1';
@ -176,6 +181,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_base36_digit;
using AK::is_ascii_binary_digit;
using AK::is_ascii_blank;
using AK::is_ascii_c0_control;