1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

AK: Add a way to disable the trimming of whitespace in to_*int

This behavior might not always be desirable, and so this patch adds a
way to disable it.
This commit is contained in:
sin-ack 2021-06-18 16:21:27 +00:00 committed by Linus Groh
parent 8be7bdaac3
commit 3abcfcc178
6 changed files with 74 additions and 61 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include "AK/StringUtils.h"
#include <AK/String.h>
namespace AK {
@ -73,9 +74,9 @@ public:
FlyString to_lowercase() const;
template<typename T = int>
Optional<T> to_int() const;
Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const;
template<typename T = unsigned>
Optional<T> to_uint() const;
Optional<T> to_uint(TrimWhitespace = TrimWhitespace::Yes) const;
bool equals_ignoring_case(const StringView&) const;
bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;