mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringUtils.h>
|
||||
#include <AK/StringView.h>
|
||||
@@ -88,9 +89,9 @@ FlyString::FlyString(const char* string)
|
||||
{
|
||||
}
|
||||
|
||||
int FlyString::to_int(bool& ok) const
|
||||
Optional<int> FlyString::to_int() const
|
||||
{
|
||||
return StringUtils::convert_to_int(view(), ok);
|
||||
return StringUtils::convert_to_int(view());
|
||||
}
|
||||
|
||||
bool FlyString::equals_ignoring_case(const StringView& other) const
|
||||
|
||||
Reference in New Issue
Block a user