LibJS: Implement (mostly) spec compliant version of Number.toString()

This commit is contained in:
Stephan Unverwerth 2020-12-26 11:30:14 +01:00 committed by Andreas Kling
parent be9c2feff0
commit d3524f47a0
Notes: sideshowbarker 2024-07-19 00:32:16 +09:00
4 changed files with 151 additions and 20 deletions

View file

@ -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;