[Java]Replacing Text

Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
How do you replace text like.
Lets say i have a list of texts i want to censor in a file.
I can read it but how do i make it censor it?
For eg : Lets say i want it to censor the word narb which is from the file.

I type : You're a narb
It shows : You're a ****
 
I figured out the problem already.
I needed
Code:
for(int i=0 ; i<word.length() ; i++)
                    charWord += '*';

Can anyone teach me how to load a list of texts into cache?

Use a hashmap ;) you can load and remove values, as well as retrieve them.
 
And while a HashMap would be effective for quick access and storing, if you'd rather be able to loop through the words alphabetically, you may want to take a look at a TreeMap instead.
 
Back