Link to home
Start Free TrialLog in
Avatar of mohan21_kumar
mohan21_kumar

asked on

How to split the new line character("\n") in string in JAVA

Hi,

   I have a string where there is a new line character ("\n") and i want to split the new line character .
Example of string :
   afasdfasdf
sfasdfasdffgsdgsg
dfhdgg
ghjh

After splitint the above string with str.split("\n");
i'm not able to get the splited part of the string pls suggest me how to split a string according to new line character

Thanx
ASKER CERTIFIED SOLUTION
Avatar of MURUGESAN N
MURUGESAN N
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mohankumarbangalore
mohankumarbangalore

the above code works but i want to check it for the file and split the file into no of files according to tne paragraph
http://www.javacoffeebreak.com/java103/java103.html

Here you can have a view on file handling in java.