mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-17 16:42:54 +00:00
LibJS: Implement (mostly) spec compliant version of Number.toString()
This commit is contained in:
parent
be9c2feff0
commit
d3524f47a0
Notes:
sideshowbarker
2024-07-19 00:32:16 +09:00
Author: https://github.com/sunverwerth
Commit: d3524f47a0
Pull-request: https://github.com/SerenityOS/serenity/pull/3803
Reviewed-by: https://github.com/linusg
4 changed files with 151 additions and 20 deletions
|
@ -364,6 +364,15 @@ int String::replace(const String& needle, const String& replacement, bool all_oc
|
|||
return positions.size();
|
||||
}
|
||||
|
||||
String String::reverse() const
|
||||
{
|
||||
StringBuilder reversed_string;
|
||||
for (size_t i = length(); i-- > 0;) {
|
||||
reversed_string.append(characters()[i]);
|
||||
}
|
||||
return reversed_string.to_string();
|
||||
}
|
||||
|
||||
String escape_html_entities(const StringView& html)
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue