mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-08 16:55:01 +00:00
AK: Add the parse_ascii_base36_digit method
This is similar to parse_ascii_hex_digit but can parse the whole A-Z range (also known as base36).
This commit is contained in:
committed by
Linus Groh
parent
26a0dbdd9e
commit
2011fcff24
@@ -140,6 +140,17 @@ constexpr u32 parse_ascii_hex_digit(u32 code_point)
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
constexpr u32 parse_ascii_base36_digit(u32 code_point)
|
||||
{
|
||||
if (is_ascii_digit(code_point))
|
||||
return parse_ascii_digit(code_point);
|
||||
if (code_point >= 'A' && code_point <= 'Z')
|
||||
return code_point - 'A' + 10;
|
||||
if (code_point >= 'a' && code_point <= 'z')
|
||||
return code_point - 'a' + 10;
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using AK::is_ascii;
|
||||
@@ -161,6 +172,7 @@ using AK::is_unicode_control;
|
||||
using AK::is_unicode_noncharacter;
|
||||
using AK::is_unicode_scalar_value;
|
||||
using AK::is_unicode_surrogate;
|
||||
using AK::parse_ascii_base36_digit;
|
||||
using AK::parse_ascii_digit;
|
||||
using AK::parse_ascii_hex_digit;
|
||||
using AK::to_ascii_lowercase;
|
||||
|
||||
Reference in New Issue
Block a user