Skip to content

Instantly share code, notes, and snippets.

Last active Feb 24, 2020
What would you like to do?
guard let hyphen = chineseDate.firstIndex(of: "-") else {
fatalError("\(chineseDate) is not correctly formatted, use DateFormatter.Style.full")
let startIndex = chineseDate.index(after: hyphen)
let endIndex = chineseDate.index(chineseDate.endIndex, offsetBy: -2)
let branch = chineseDate[startIndex ... endIndex]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment