I hereby claim:
- I am macmedan on github.
- I am macmedan (https://keybase.io/macmedan) on keybase.
- I have a public key ASBmUfgfucVoU0MNe7QCDNrzAxCLCJZ-qq9NNs1uM2I4Igo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
extension String { | |
// created by - Dan Leonard 3/6/2018 | |
// https://gist.github.com/MacMeDan/491fbe1361bafaa009adce6bf549f5d5 | |
/// lowercased to start and Capitalised each segment that fallows. | |
/// if there are more then 10 words in the sentence | |
var camelCased: String { | |
var componets = self.components(separatedBy: " ") | |
guard let first = componets.first?.lowercased() else { fatalError("Invalid string for enum generation") } | |
if componets.count == 1 { return "\(first)"} | |
let rest = componets.dropFirst().flatMap{ $0.capitalized }.joined() |
extension String { | |
// created by - Dan Leonard 3/6/2018 | |
// https://gist.github.com/MacMeDan/ef9e49dfbab19f084da5cb43d48a77b0 | |
// NOTE: does not account for individual numbers | |
var validChars: String { | |
return String(describing: filter { String($0).rangeOfCharacter(from: .alphanumerics) != nil }) | |
} | |
} |