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
commit 3abcfcc178
Notes: sideshowbarker 2024-07-18 12:03:53 +09:00
6 changed files with 74 additions and 61 deletions

View file

@ -112,9 +112,9 @@ public:
[[nodiscard]] bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
template<typename T = int>
[[nodiscard]] Optional<T> to_int() const;
[[nodiscard]] Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const;
template<typename T = unsigned>
[[nodiscard]] Optional<T> to_uint() const;
[[nodiscard]] Optional<T> to_uint(TrimWhitespace = TrimWhitespace::Yes) const;
[[nodiscard]] String to_lowercase() const;
[[nodiscard]] String to_uppercase() const;