I have no idea what those values are. What happened to their id strings?
Printable View
I have no idea what those values are. What happened to their id strings?
Sorry,
d2index : 4
dindex : 0
delWord: baa
word : baa
x: -1
Now the words match, which should make everything just peachy, but it still throws an array out of bounds. I just don't see where it's coming in from.
You need to print out the values of ALL the variables you are using.
What is the value of output?
Be sure to add a trailing char like a < to the output to show any trailing spaces.
System.out.println("censor=" + censor +"<");
It seems that the word.length is still returning as 4.
But the problem is still the indexOf for the x.
output: [baa baa black sheep,
, have you any wool,
, yes sir, yes sir, three bags full.]<
censor: [baa, any, three]<
o1: [baa baa black sheep,
, have you any wool,
, yes sir, yes sir, three bags full.]<
c1: [baa, any, three]<
d2index: 4 <
dindex: 0 <
delWord: baa<
word: baa<
x: -1<
aster: ****<
I just printed out the values of delWord for censors indexOf and it's returning 0 which is a good thing because that's where the value is. But I need to replace the word that's in Output not Censor.
What element in the Vector output equals the contents of word?
the element "baa" is the word that I'm trying to censor in this file, along with "any" and "three". I do notice that the word baa shows up twice, do you think that's the error? I'll remove baa from the vector and find out.
The list or look at the elements in the Vector output and see if any off them are equal to the contents of the variable word.