Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Last active December 10, 2022 11:09
Show Gist options
  • Save MelanieS/2ad846be326800e891d880ff15cb36c1 to your computer and use it in GitHub Desktop.
Save MelanieS/2ad846be326800e891d880ff15cb36c1 to your computer and use it in GitHub Desktop.
string = 'This is a Ruby tutorial.'
string.count('i')
# This returns the integer 3
# case sensitive example
string.count('r')
# This returns the integer 1
string.count('r', + 'R')
# This returns the integer 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment