mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02: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:
Notes:
sideshowbarker
2024-07-19 05:41:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fdfda6dec20
@@ -39,9 +39,9 @@ enum class CaseSensitivity {
|
||||
namespace StringUtils {
|
||||
|
||||
bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive);
|
||||
int convert_to_int(const StringView&, bool& ok);
|
||||
unsigned convert_to_uint(const StringView&, bool& ok);
|
||||
unsigned convert_to_uint_from_hex(const StringView&, bool& ok);
|
||||
Optional<int> convert_to_int(const StringView&);
|
||||
Optional<unsigned> convert_to_uint(const StringView&);
|
||||
Optional<unsigned> convert_to_uint_from_hex(const StringView&);
|
||||
bool equals_ignoring_case(const StringView&, const StringView&);
|
||||
bool ends_with(const StringView& a, const StringView& b, CaseSensitivity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user