urlencode string swift
let originalString = "test/test"
let escapedString = originalString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
print(escapedString!)
urlencode string swift
let originalString = "test/test"
let escapedString = originalString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
print(escapedString!)
swift url encode string
var urlString = originalString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
getting web safe strings xcode
extension String {
private static let slugSafeCharacters = CharacterSet(charactersIn: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-")
public func convertedToSlug() -> String? {
if let latin = self.applyingTransform(StringTransform("Any-Latin; Latin-ASCII; Lower;"), reverse: false) {
let urlComponents = latin.components(separatedBy: String.slugSafeCharacters.inverted)
let result = urlComponents.filter { $0 != "" }.joined(separator: "-")
if result.count > 0 {
return result
}
}
return nil
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us