Results 21 to 28 of 28
Thread: trouble with FILE I/O
- 12-02-2011, 08:54 PM #21
- 12-02-2011, 08:55 PM #22
Member
- Join Date
- Nov 2011
- Location
- New Hampshire
- Posts
- 29
- Rep Power
- 0
Re: trouble with FILE I/O
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.
- 12-02-2011, 08:59 PM #23
Re: trouble with FILE I/O
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 +"<");
- 12-02-2011, 09:08 PM #24
Member
- Join Date
- Nov 2011
- Location
- New Hampshire
- Posts
- 29
- Rep Power
- 0
Re: trouble with FILE I/O
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: ****<
- 12-02-2011, 09:12 PM #25
Member
- Join Date
- Nov 2011
- Location
- New Hampshire
- Posts
- 29
- Rep Power
- 0
Re: trouble with FILE I/O
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.
- 12-02-2011, 09:13 PM #26
Re: trouble with FILE I/O
What element in the Vector output equals the contents of word?
- 12-02-2011, 09:22 PM #27
Member
- Join Date
- Nov 2011
- Location
- New Hampshire
- Posts
- 29
- Rep Power
- 0
Re: trouble with FILE I/O
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.
- 12-02-2011, 09:25 PM #28
Similar Threads
-
Log file trouble
By kovalensue in forum Advanced JavaReplies: 3Last Post: 04-03-2011, 05:13 PM -
Having trouble opening and reading a txt file
By DBaskov in forum New To JavaReplies: 14Last Post: 01-29-2011, 02:55 AM -
Trouble with Try Catch blocks and file reading.
By theBurgh22 in forum New To JavaReplies: 2Last Post: 11-30-2010, 01:11 AM -
Having trouble reading external txt file to an array
By Metastar in forum New To JavaReplies: 18Last Post: 07-21-2010, 11:29 PM -
[SOLVED] Trouble with Scanner FileInputStream not finding the file
By miss.meli in forum New To JavaReplies: 0Last Post: 12-01-2008, 09:50 PM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks