Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
removed ns string again since it is not supported on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Casperhr committed Dec 25, 2016
1 parent 9aece15 commit a9ccae7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Sources/Slugify/String+Slugify.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension String {
private static let allowedCharacters = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")
private static let allowedCharacters = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyz0123456789-_")

private static let replaceChars: [String: [String]] = [
"0": ["°", "", "۰"],
Expand Down Expand Up @@ -142,12 +142,7 @@ extension String {
// Lower case
copy = copy.lowercased()


let nsString = NSMutableString(string: copy) as CFMutableString
CFStringTransform(nsString, nil, kCFStringTransformToLatin, false)
CFStringTransform(nsString, nil, kCFStringTransformStripCombiningMarks, false)

return String(nsString)
return copy
.components(separatedBy: String.allowedCharacters.inverted)
.filter { $0 != "" }
.joined(separator: "-")
Expand Down

0 comments on commit a9ccae7

Please sign in to comment.