So I have, for example, a string such as this C3H20IO
C3H20IO
What I wanna do is split this string so I get the following:
Array1 = {C,H,I,O} Ar
I did this as following
ArrayList integerCharacters = new ArrayList(); ArrayList stringCharacters = new ArrayList<>(); String value = "C3H20IO"; //Your value String[] strSplitted = value.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)"); //Split numeric and strings for(int i=0; i