1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:55:07 +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:
Andreas Kling 2020-06-12 21:07:52 +02:00
parent 15f4043a7a
commit fdfda6dec2
55 changed files with 354 additions and 455 deletions

View file

@ -215,14 +215,14 @@ StringView StringView::substring_view_starting_after_substring(const StringView&
return { remaining_characters, remaining_length };
}
int StringView::to_int(bool& ok) const
Optional<int> StringView::to_int() const
{
return StringUtils::convert_to_int(*this, ok);
return StringUtils::convert_to_int(*this);
}
unsigned StringView::to_uint(bool& ok) const
Optional<unsigned> StringView::to_uint() const
{
return StringUtils::convert_to_uint(*this, ok);
return StringUtils::convert_to_uint(*this);
}
unsigned StringView::hash() const