Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'iOSClient/Extensions/String+Extensions.swift')
-rw-r--r--iOSClient/Extensions/String+Extensions.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/iOSClient/Extensions/String+Extensions.swift b/iOSClient/Extensions/String+Extensions.swift
index 4e0fa5131..27aefad99 100644
--- a/iOSClient/Extensions/String+Extensions.swift
+++ b/iOSClient/Extensions/String+Extensions.swift
@@ -69,6 +69,13 @@ extension String {
return digestData.map { String(format: "%02hhx", $0) }.joined()
}
+
+ var urlEncoded: String? {
+ // + for historical reason, most web servers treat + as a replacement of whitespace
+ // ?, & mark query pararmeter which should not be part of a url string, but added seperately
+ let urlAllowedCharSet = CharacterSet.urlQueryAllowed.subtracting(["+", "?", "&"])
+ return addingPercentEncoding(withAllowedCharacters: urlAllowedCharSet)
+ }
}
extension StringProtocol {