mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +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:
parent
90bab5ea71
commit
8135952832
4 changed files with 19 additions and 9 deletions
|
@ -65,6 +65,8 @@ Vector<String> String::split(const char separator) const
|
|||
size_t taillen = length() - substart;
|
||||
if (taillen != 0)
|
||||
v.append(substring(substart, taillen));
|
||||
if (characters()[length() - 1] == separator)
|
||||
v.append(empty());
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue