Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Last active Dec 10, 2022
Embed
What would you like to do?
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