• Post Reply Bookmark Topic Watch Topic
  • New Topic

splitting TextFile  RSS feed

 
L Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say I have a TextFile that containsNote: this isnt the real textfile contents, but just a small bit made up one)
Parrot a bird, often vividly colored, with a short down-curved hooked bill, grasping feet, and a raucous voice, found especially in the tropics and feeding on fruits and seeds.
judgement the ability to make considered decisions or come to sensible conclusions.
juvenile of, for, or relating to young people.
amplitude the maximum extent of a vibration or oscillation, measured from the position of equilibrium.
forest a large area covered chiefly with trees and undergrowth.
department a division of a large organization such as a government, university, business, or shop, dealing with a specific subject, commodity, or area of activity.


I want to split the word from the definition, I was able to split the word using this method, but I want to split and add the definition to the textfile instead of having the words go into the textfile.
I've tried changing defi[0] to defi[1], but it would only give me a arrayindexoutofboundsexception. So my question is how would I make it so the definitions will go into the textfile, excluding the word.


Thank you for your input in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37465
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you print out linee what does it print?
 
L Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:If you print out linee what does it print?


It prints out the words and definitions together
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another useful debug tool is the Arrays class's toString() method to format the contents of an array for printing.
 
L Johnson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:Another useful debug tool is the Arrays class's toString() method to format the contents of an array for printing.

I have used this method multiple times, although I dont really think it has any use here in this case. Since It's already printing out the words, its just not printing out the definition without the words. Thank you for the information though. It seems as if only the words are contained in the array, but when I create a forloop to check the contents of the array it prints out all the words + definition.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the program's output so we can see what you are talking about?
Also post a sample of what the desired output looks like.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!