mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
AK: Add URL::to_string_encoded()
The result of to_string() passed to urlencode(), with some characters excluded - basically like JavaScript's encodeURI().
This commit is contained in:
parent
50e3b122c7
commit
e0066ff2d7
1 changed files with 6 additions and 0 deletions
6
AK/URL.h
6
AK/URL.h
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/URLParser.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
@ -63,6 +64,11 @@ public:
|
|||
|
||||
String basename() const;
|
||||
String to_string() const;
|
||||
String to_string_encoded() const
|
||||
{
|
||||
// Exclusion character set is the same JS's encodeURI() uses
|
||||
return urlencode(to_string(), "#$&+,/:;=?@");
|
||||
}
|
||||
|
||||
URL complete_url(const String&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue