|
-
August 2nd, 2012, 01:50 PM
#1
Nextline delimiter in String.split
Hello, I'm new to the forums. I'm learning Java and would appreciate help with a small issue. I'm trying to do the following: Enter a piece of text (all through console, in this case I'm working with Netbeans), and convert each line of the text into a String.
String[] textArray = text.split("\r?\n|\r");
The delimiter "\r?\n|\r" is one of the many I found in google, I have no idea if it's right. It seems to get the first line right and save it in textArray[0], but the array only has that one element regardless of the number of lines I enter.
The console seems to allow the "nextline" character as input, so I think I have the wrong delimiter. Does anybody know which is the correct one?
Any help will be greatly appreciated. Thanks in advance.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|