Reputation: 99
I have a String. I want to split string in multiple string occurrences. Ex:
String str= "A809C0034F3A04C9024F80A905C5034F6008AA08C2024F4ACB024F5AFFFF";
A809C0034F3A04C9024F80A905C5034F6008AA08C2024F4ACB024F5AFFFF
I want split string at A8 , A9 and AA. can you please provide information about this.
Upvotes: 1
Views: 689
Reputation: 2191
String str= "A809C0034F3A04C9024F80A905C5034F6008AA08C2024F4ACB024F5AFFFF";
String[] s = str.split("A[8|9|A]");
for(String st:s){
System.out.println(st);
}
Upvotes: 1
Reputation: 4509
Well You have to use split()
and accept multiple matches .
String str= "A809C0034F3A04C9024F80A905C5034F6008AA08C2024F4ACB024F5AFFFF";
String[] splits = str.split("A8|A9|AA");
for(String st:splits){
System.out.println(st);
}
output:
09C0034F3A04C9024F80
05C5034F6008
08C2024F4ACB024F5AFFFF
Upvotes: 2