Skip to content

Commit

Permalink
Adds missing subscript extension
Browse files Browse the repository at this point in the history
  • Loading branch information
acadet committed Jun 19, 2015
1 parent 9b3241a commit ed3f7cb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions caravel/utils/StringExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@

import Foundation

extension String {
internal extension String {
subscript (i: Int) -> Character {
return self[advance(self.startIndex, i)]
}

subscript (i: Int) -> String {
return String(self[i] as Character)
}
}

subscript (r: Range<Int>) -> String {
return substringWithRange(Range(start: advance(startIndex, r.startIndex), end: advance(startIndex, r.endIndex)))
}
}

0 comments on commit ed3f7cb

Please sign in to comment.