Ruby - String Operations
What is the main difference between
sub and gsub methods in Ruby?sub and gsub methods in Ruby?sub behaviorsub replaces only the first occurrence of the pattern in the string.gsub behaviorgsub replaces all occurrences of the pattern in the string.sub replaces only the first match, gsub replaces all matches. -> Option B15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions