mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 09:04:30 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
@@ -196,14 +196,14 @@ ByteBuffer String::to_byte_buffer() const
|
||||
return ByteBuffer::copy(reinterpret_cast<const u8*>(characters()), length());
|
||||
}
|
||||
|
||||
int String::to_int(bool& ok) const
|
||||
Optional<int> String::to_int() const
|
||||
{
|
||||
return StringUtils::convert_to_int(this->view(), ok);
|
||||
return StringUtils::convert_to_int(view());
|
||||
}
|
||||
|
||||
unsigned String::to_uint(bool& ok) const
|
||||
Optional<unsigned> String::to_uint() const
|
||||
{
|
||||
return StringUtils::convert_to_uint(this->view(), ok);
|
||||
return StringUtils::convert_to_uint(view());
|
||||
}
|
||||
|
||||
String String::number(unsigned long long value)
|
||||
|
||||
Reference in New Issue
Block a user