summaryrefslogtreecommitdiff
path: root/AK/String.h
diff options
context:
space:
mode:
authorSahan Fernando <sahan.h.fernando@gmail.com>2020-12-11 00:17:30 +1100
committerAndreas Kling <kling@serenityos.org>2020-12-21 00:15:44 +0100
commit37df4bbd9060fdc08d0632d06b167e9bae36a0f8 (patch)
treea4686a03d4e46d25eda8a2df3d8e36736dc884ac /AK/String.h
parent39364bdda43d307af8836743227d278d4bb7525e (diff)
downloadserenity-37df4bbd9060fdc08d0632d06b167e9bae36a0f8.zip
AK: Generalize AK::String::to_int() for more types
Diffstat (limited to 'AK/String.h')
-rw-r--r--AK/String.h6
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;