Last active
June 13, 2016 13:31
-
-
Save marcusshepp/c9ddc29cf274bfd42954337db201b5be to your computer and use it in GitHub Desktop.
rindex
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
# returns last index of occurance | |
s = "marcus shepherd" | |
x = s.rindex(" ") | |
# => 6 | |
s[0..x-1] | |
# => "marcus" | |
s[x+1..s.length] | |
# => "shepherd" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment