1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

AK: Add StringView::to_int()

This is a shameless copy-paste of String::to_int(). We should find some
way to share this code between String and StringView instead of having
two duplicate copies like this.
This commit is contained in:
Andreas Kling 2019-08-04 11:44:20 +02:00
parent c55129e573
commit cce2ea9bb0
3 changed files with 32 additions and 0 deletions

View file

@ -41,7 +41,10 @@ public:
StringView substring_view(int start, int length) const;
Vector<StringView> split_view(char) const;
// FIXME: These should be shared between String and StringView somehow!
unsigned to_uint(bool& ok) const;
int to_int(bool& ok) const;
// Create a new substring view of this string view, starting either at the beginning of
// the given substring view, or after its end, and continuing until the end of this string