-6

so how can split this combination in android ?

Thanks in advance :)`

i'm trying like thatString lines[] = String.split("\\r?\\n", -1); but how can split all data in one time

shweta jariya
  • 233
  • 4
  • 7

1 Answers1

0

You can use Pattern for regex split

String fields = "name[Employee Name], employeeno[Employee No], dob[Date of 
Birth], joindate[Date of Joining]";

Pattern pattern = Pattern.compile("\\[.+\\]+?,?\\s*" );

String[] split = pattern.split(fields);

References: How to split this string using Java Regular Expressions

Community
  • 1
  • 1
Rashid
  • 1,700
  • 1
  • 23
  • 56