mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 18:46:18 +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
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…
Reference in a new issue