Created
February 25, 2015 15:06
-
-
Save masters3d/3a501529f26b6a797292 to your computer and use it in GitHub Desktop.
SubString using Int instead of StringIndex Type
This file contains 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
extension String{ | |
func substringFromIndexInt(indx:Int) -> String { | |
let index = advance(self.startIndex, indx) | |
return self.substringFromIndex(index) | |
} | |
func substringWithRangeInt(intRange:Range<Int>)->String{ | |
let start = advance(self.startIndex,intRange.startIndex) | |
let end = advance(self.startIndex,intRange.endIndex) | |
return self.substringWithRange(start..<end) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment