Last active
February 27, 2018 10:21
-
-
Save mwrites/d4fd3354f2e187f8b98e5df78a657863 to your computer and use it in GitHub Desktop.
StringCompat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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