mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
AK: Add StringBuilder::string_view() and StringBuilder::clear()
The former allows you to inspect the string while it's being built. It's an explicit method rather than `operator StringView()` because you must remember you can only look at it in between modifications; appending to the StringBuilder invalidates the StringView. The latter lets you clear the state of a StringBuilder explicitly, to start from an empty string again.
This commit is contained in:
parent
fd0aa5dd43
commit
08d9883306
2 changed files with 15 additions and 2 deletions
|
@ -24,6 +24,9 @@ public:
|
|||
String to_string();
|
||||
ByteBuffer to_byte_buffer();
|
||||
|
||||
StringView string_view() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
void will_append(int);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue