diff options
author | Sahan Fernando <sahan.h.fernando@gmail.com> | 2020-12-11 00:17:30 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-21 00:15:44 +0100 |
commit | 37df4bbd9060fdc08d0632d06b167e9bae36a0f8 (patch) | |
tree | a4686a03d4e46d25eda8a2df3d8e36736dc884ac /AK/String.h | |
parent | 39364bdda43d307af8836743227d278d4bb7525e (diff) | |
download | serenity-37df4bbd9060fdc08d0632d06b167e9bae36a0f8.zip |
AK: Generalize AK::String::to_int() for more types
Diffstat (limited to 'AK/String.h')
-rw-r--r-- | AK/String.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/AK/String.h b/AK/String.h index edeceeb87b..c30f8bb715 100644 --- a/AK/String.h +++ b/AK/String.h @@ -114,8 +114,10 @@ public: bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - Optional<int> to_int() const; - Optional<unsigned> to_uint() const; + template<typename T = int> + Optional<T> to_int() const; + template<typename T = unsigned> + Optional<T> to_uint() const; String to_lowercase() const; String to_uppercase() const; |