Reputation: 391
How can I split following string in two strings?
input:
00:02:05,130 --> 00:02:10,130
output:
00:02:05,130
00:02:10,130
i tried this piece of code:
String[] tokens = my.split(" --> ");
System.out.println(tokens.length);
for(String s : tokens)
System.out.println(s);
but the out put is just the first part, what is wrong?
Upvotes: 0
Views: 116
Reputation: 11486
You could use the String split()
:
String str = "00:02:05,130 --> 00:02:10,130";
String[] str_array = str.split(" --> ");
String stringa = str_array[0];
String stringb = str_array[1];
You may want to have a look at the following: Split Java String into Two String using delimiter
Upvotes: 1