There is a row of type HAT523HAT524HAT525
. Tell me, please, how can you split this line like this:
c1 = "HAT523";
C2 = "HAT524";
C3 = "HAT525"; `
Answer 1, Authority 100%
You can use a regular expression. Flexib and possibly any number of matches.
Pattern Pattern = Pattern.compile ("Hat52 \\ D");
String Line = "HAT523HAT524HAT525";
Matcher Matcher = Pattern.matcher (Line);
String [] Array = New String [3];
For (int i = 0; matcher.find (); i ++) {
Array [i] = Matcher.group ();
}
System.out.PrintLN (Array.Tostring (Array));
Answer 2
You can use the SUBSTRING () method.
string s = "hat523hat524hot525";
String C1, C2, C3;
c1 = s.substring (0, 6);
C2 = S.Substring (6, 12);
C3 = S.SUBSTRING (12);