-2

I have a string with example

• How are you. • I am fine. • ThirdLine.

Now I want to detect all • occurrences and store in an array. The array would contain three entries

•How are you
•I am fine
•ThirdLine

How can this be done in java

Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193

2 Answers2

0

You can use Split() method with desired delimiter

 String[] splitted= line.split("\\•");  //line is your whole string
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
0
str = "• How are you. • I am fine. • ThirdLine.";
String[] list = str.split("\\•");
fcm
  • 6,305
  • 5
  • 24
  • 37