Mega Code Archive

 
Categories / Ruby / String
 

Checking for prefixes and suffixes

s = "hello" s.start_with? "hell" # => true.  Note singular "start" not "starts" s.end_with? "bells"  # => false