Skip to content

Instantly share code, notes, and snippets.

@jswhisperer
Created June 18, 2013 16:27
Show Gist options
  • Select an option

  • Save jswhisperer/5806905 to your computer and use it in GitHub Desktop.

Select an option

Save jswhisperer/5806905 to your computer and use it in GitHub Desktop.
Find substring with CoffeeScript
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