Java split string, the first char is a space

Joined
Dec 30, 2009
Messages
1
Reaction score
0
Hi guys,
I'm doing 2 splits from a txt file, the 1st split saves the 1st char of the file
the next split saves the rest of the line.
For example the line is:
"Ab Just an example"
The first split saves.me the word "Ab" but the other split saves the phrase:
" Just an example" the thing is that I get an empty space in the begining of the phrase, what I need to change?

The code that I'm using is:
firstChar=txtFile.next().split(" ");
theRestPhrase=txtFile.nextLine().split("\n");

Thanks and sorry my poor english.
Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top