Q:

Write a Ruby program to remove a substring from a specified string

0

Write a Ruby program to remove a substring from a specified string.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def check_string(my_string, substr)
  my_string.slice! substr
  return my_string
end
print check_string("JavaScript", "Script")
print "\n",check_string("HTMLCSS", "HTML")

Output:

Java
CSS

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now