Skip to content

Instantly share code, notes, and snippets.

View imjhk03's full-sized avatar
🤒
Injured, but still vibing

Joohee Kim imjhk03

🤒
Injured, but still vibing
View GitHub Profile
extension StringProtocol {
subscript(_ offset: Int) -> String.Element {
if offset >= 0 {
self[index(startIndex, offsetBy: offset)]
} else {
self[index(endIndex, offsetBy: offset)]
}
}