Created
June 18, 2013 16:27
-
-
Save jswhisperer/5806905 to your computer and use it in GitHub Desktop.
Find substring with CoffeeScript
This file contains hidden or 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
| message = "This is a test string. This has a repeat or two. This might even have a third." | |
| message.indexOf "This", 0 | |
| # => 0 | |
| # Modifying the start parameter | |
| message.indexOf "This", 5 | |
| # => 23 | |
| message.lastIndexOf "This" | |
| # => 49 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment