Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

HELP WITH JAVA 101

Name: Anonymous 2009-02-12 14:43

Can someone help me write a Java program that does this?
It simply changes the word "hate" to "love"

Enter a sentence containing the word "hate":
hate is such a strong word

Your revised sentence is:
love is such a strong word

Name: Anonymous 2009-02-12 15:06

print qq{Enter a sentence containing the word "hate":\n};
(my $word=<>)=~s/hate/love/g;
print qq{\nYour revised sentence is:\n$word\n};


Enjoy

Name: Anonymous 2009-02-12 15:11

replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace [] _ _ = []
replace s find repl | take (length find) s == find = repl ++ (replace (drop (length find) s) find repl)
                    | otherwise                    = [head s] ++ (replace (tail s) find repl)

main = putStrLn $replace "hate is such a strong word" "hate" "love"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List