1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:37:45 +00:00

Add a Chomp feature to String construction that removes a trailing newline.

This will be useful in many situations.
This commit is contained in:
Andreas Kling 2018-11-07 00:19:35 +01:00
parent 90bab5ea71
commit 8135952832
4 changed files with 19 additions and 9 deletions

View file

@ -6,11 +6,13 @@
namespace AK {
enum ShouldChomp { NoChomp, Chomp };
class StringImpl : public Retainable<StringImpl> {
public:
static RetainPtr<StringImpl> createUninitialized(size_t length, char*& buffer);
static RetainPtr<StringImpl> create(const char* cstring);
static RetainPtr<StringImpl> create(const char* cstring, size_t length);
static RetainPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp);
static RetainPtr<StringImpl> create(const char* cstring, size_t length, ShouldChomp = NoChomp);
RetainPtr<StringImpl> toLowercase() const;
RetainPtr<StringImpl> toUppercase() const;
@ -50,3 +52,4 @@ private:
}
using AK::StringImpl;
using AK::Chomp;