mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibJS: Define Utf16String::to_utf8 to convert Utf16String to String
This commit is contained in:
parent
4eb5eb2080
commit
c79d20be58
Notes:
sideshowbarker
2024-07-17 09:47:09 +09:00
Author: https://github.com/trflynn89
Commit: c79d20be58
Pull-request: https://github.com/SerenityOS/serenity/pull/17014
Reviewed-by: https://github.com/linusg ✅
2 changed files with 6 additions and 0 deletions
|
@ -102,6 +102,11 @@ Utf16View Utf16String::substring_view(size_t code_unit_offset) const
|
|||
return view().substring_view(code_unit_offset);
|
||||
}
|
||||
|
||||
ThrowCompletionOr<String> Utf16String::to_utf8(VM& vm) const
|
||||
{
|
||||
return TRY_OR_THROW_OOM(vm, view().to_utf8(Utf16View::AllowInvalidCodeUnits::Yes));
|
||||
}
|
||||
|
||||
ThrowCompletionOr<DeprecatedString> Utf16String::to_deprecated_string(VM& vm) const
|
||||
{
|
||||
return TRY_OR_THROW_OOM(vm, view().to_deprecated_string(Utf16View::AllowInvalidCodeUnits::Yes));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue