Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Durril Jansen   on Nov 26 In Java Category.

  
Question Answered By: Vidos Fischer   on Nov 26

here is one example  how to use the split() function:

String s1="Hi, my name is ABCDE. \n I am 25 years old.\n";
String[] result=s1.split("\n");
for(int i=0;i<result.length;i++)
System.out.println(result[i]);

The output is: Line 1:Hi, my name is ABCDE.
Line 2:I am 25 years old.

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on breaking a String into a String[] Or get search suggestion and latest updates.


Tagged: