Skip to content

Instantly share code, notes, and snippets.

@aoenth
Last active Feb 24, 2020
Embed
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]
print(branch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment