Skip to content

Instantly share code, notes, and snippets.

@edenthecat
Created December 9, 2015 18:28
Show Gist options
  • Save edenthecat/2babbba41236de3d568d to your computer and use it in GitHub Desktop.
Save edenthecat/2babbba41236de3d568d to your computer and use it in GitHub Desktop.
Ruby: Remove Filtered Characters from a String
def filterString
originalString = "Hello this is dog"
filter = "Hdgol"
puts "the original string is " + originalString
puts "filter: " + filter
splitString = originalString.split(//)
splitFilter = filter.downcase.split(//)
for i in splitFilter
splitString.delete(i)
splitString.delete(i.upcase)
end
puts splitString.join()
end
filterString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment