1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:08:12 +00:00

AK: Add String::copy(BufferType) helper.

This will create a String from any BufferType that has data() and size().
This commit is contained in:
Andreas Kling 2019-04-20 14:13:40 +02:00
parent 5eedb22834
commit ab94a6be00
11 changed files with 31 additions and 27 deletions

View file

@ -122,15 +122,6 @@ ByteBuffer String::to_byte_buffer() const
return ByteBuffer::copy(reinterpret_cast<const byte*>(characters()), length());
}
String String::from_byte_buffer(const ByteBuffer& buffer, ShouldChomp should_chomp)
{
if (buffer.is_null())
return { };
if (buffer.is_empty())
return empty();
return String((const char*)buffer.pointer(), buffer.size(), should_chomp);
}
// FIXME: Duh.
int String::to_int(bool& ok) const
{