Adjust url encode for +
This commit is contained in:
parent
c3d401059a
commit
af91f7dc5a
|
@ -6,8 +6,7 @@
|
|||
### ✨ New features
|
||||
|
||||
* `String+Characters` contains single-char characters like `newLine` and `tab`.
|
||||
* `String+Subscript` contains functionality for accessing chars in a String.
|
||||
|
||||
* `String+Subscript` contains functionality for accessing chars in a String.
|
||||
|
||||
|
||||
## 1.0
|
||||
|
|
|
@ -17,10 +17,11 @@ public extension String {
|
|||
|
||||
This will first call `addingPercentEncoding`, using the
|
||||
`.urlPathAllowed` character set, then replace every `&`
|
||||
with `%26`.
|
||||
with `%26` and + with %2B.
|
||||
*/
|
||||
func urlEncoded() -> String? {
|
||||
addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)?
|
||||
.replacingOccurrences(of: "&", with: "%26")
|
||||
.replacingOccurrences(of: "+", with: "%2B")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue