Skip to content

Instantly share code, notes, and snippets.

@Bionik6
Created March 21, 2016 17:50
Show Gist options
  • Select an option

  • Save Bionik6/507a3394a34b2502331d to your computer and use it in GitHub Desktop.

Select an option

Save Bionik6/507a3394a34b2502331d to your computer and use it in GitHub Desktop.
func generateUniqueKey(keys: String...) -> String {
let newArray = keys.sort()
var cuttedStr = [String]()
for str in newArray {
let newString = NSString(string: str)
let result = newString.substringWithRange(NSRange(location: 0, length: 8))
cuttedStr.append(result)
}
return cuttedStr.joinWithSeparator("-")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment