0

i want to read this string

 String  "abc;def;ghi;jklm;nopqr"

i want to get these diffrent diffrent

  string a = abc;
  string b = def;
      string c = ghi;
     string f = nopqr;`

how i read this , plz help me,

Rohit
  • 3,401
  • 4
  • 33
  • 60

2 Answers2

3

You can use the split method:

String[] tokens = str.split(";")

for example:

String myString = "abc;def;ghi;jklm;nopqr";
String[] tokens = myString.split(";")
//tokens[0]="abc"
//tokens[1]="def"
//...
Sebastian Breit
  • 6,137
  • 1
  • 35
  • 53
0

Try this:

String string = "aaa;bbb";
String[] parts = string.split(";");
String part1 = parts[0]; //aaa
String part2 = parts[1];//bbb
Android_coder
  • 9,953
  • 3
  • 17
  • 23