Answers for "c#convert URL string with %A to normal url string"

0

url encode xcode

func addingPercentEncoding(withAllowedCharacters allowedCharacters: CharacterSet) -> String?
Posted by: Guest on June-21-2020
0

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
    }
}
Posted by: Guest on June-21-2020

Code answers related to "c#convert URL string with %A to normal url string"

Code answers related to "Swift"

Browse Popular Code Answers by Language