Created
October 16, 2018 19:49
-
-
Save jakehawken/a3f447b3529e0a0158f4efa862acfafc to your computer and use it in GitHub Desktop.
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
| static func -=(lhs: inout String, rhs: String) { | |
| guard lhs.hasSuffix(rhs) else { | |
| return | |
| } | |
| guard let range = lhs.range(of: rhs, options: [.backwards], range: nil, locale: nil) else { | |
| return | |
| } | |
| lhs = lhs.replacingCharacters(in: range, with: "") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment