mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
AK+Everywhere: Replace URL::paths() with path_segment_at_index()
This allows accessing and looping over the path segments in a URL without necessarily allocating a new vector if you want them percent decoded too (which path_segment_at_index() has an option for).
This commit is contained in:
parent
35612c6a7f
commit
5db1eb9961
6 changed files with 28 additions and 21 deletions
|
@ -45,6 +45,12 @@ DeprecatedString URL::password(ApplyPercentDecoding apply_percent_decoding) cons
|
|||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_password) : m_password;
|
||||
}
|
||||
|
||||
DeprecatedString URL::path_segment_at_index(size_t index, ApplyPercentDecoding apply_percent_decoding) const
|
||||
{
|
||||
VERIFY(index < path_segment_count());
|
||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_paths[index]) : m_paths[index];
|
||||
}
|
||||
|
||||
DeprecatedString URL::basename(ApplyPercentDecoding apply_percent_decoding) const
|
||||
{
|
||||
if (!m_valid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue