Skip to content

Instantly share code, notes, and snippets.

@mwrites
Last active February 27, 2018 10:21
Show Gist options
  • Save mwrites/d4fd3354f2e187f8b98e5df78a657863 to your computer and use it in GitHub Desktop.
Save mwrites/d4fd3354f2e187f8b98e5df78a657863 to your computer and use it in GitHub Desktop.
StringCompat
extension String {
extension String {
func toArray() -> [Character] {
return Array(characters)
}
#if swift(>=4)
#else
var count: Int {
return characters.count
}
mutating func removeFirst() -> Character {
return remove(at: startIndex)
}
mutating func removeLast() -> Character {
return remove(at: index(before: endIndex))
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment