DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Sadie
Sadie

Posted on

Success !

One night before my coding bootcamp begins, and I'm working my way through exercises in the prep work that I didn't get to this winter. Here is a little Ruby redactor I finally got to work !

puts "Text to search through : "
text = gets.chomp
puts "words to redact : "
redactstring = gets.chomp
word = text.split(" ")
w = []
word.each do |word|
w.push(word)
end
redact = redactstring.split(" ")
r = []
redact.each do |redact|
r.push(redact)
end

i=0
while i<w.length
w.each do |word|
if r.include?word
print "REDACTED "
else
print word + " "
end
i+=1
end

end

Top comments (0)

Hey 😍

Want to help the DEV Community feel more like a community?

Head over to the Welcome Thread and greet some new community members!

It only takes a minute of your time, and goes a long way!