string replaceall occurences with strings inside arrays
Let our string be a sentence that contains several unique terms, such as
"person1: hello, person2! person3, are you the same person as person4?"
I would like to replace person1, person2, person 3, and person4 with strings I have in a text file. In the text file, this would be an example of what it looks like:
person1=example1
person2=example2
person3=example3
person4=example3
NOTICE how person3 and person4 have the same replacer term - also, I have a bufferedreader that puts the entire text file into an array, lets name it "example".
How would I have it so that the text gets ALL the elements of array "example" so it can replace the prefix of "=" by the
suffix of "=". So, the final string would look like:
"example1: hello, example2! example3, are you the same as example3?"
Also, note that the size of array "example" is indefinite, as you can add even more lines to the text file.
Re: string replaceall occurences with strings inside arrays
Read these two recplace() functions: String (Java 2 Platform SE v1.4.2)