1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00

AK: Add String constructor from ReadonlyBytes.

This commit is contained in:
asynts 2020-08-05 10:37:34 +02:00 committed by Andreas Kling
parent 42b4880653
commit 75cde94c6a
3 changed files with 23 additions and 0 deletions

View file

@ -133,6 +133,11 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldCho
return create(cstring, strlen(cstring), shouldChomp);
}
RefPtr<StringImpl> StringImpl::create(ReadonlyBytes bytes, ShouldChomp shouldChomp)
{
return StringImpl::create(reinterpret_cast<const char*>(bytes.data()), bytes.size(), shouldChomp);
}
static inline bool is_ascii_lowercase(char c)
{
return c >= 'a' && c <= 'z';