I have to splitt a string , keeping in mind that split should at the pattern change spot.
String nxy= "xI yam yw 1a 2pro xgr xon xsig yk yn ya 2h 3h xpr xoc yes ysin yn"
String[] patterns=nxy.split( regex=??????? );
String has three types of words. 1. starting with number : 1a, 2h etc. 2. starting with x: xl, xgr, xon etc. 3. starting with y: yam, yn, ye etc.
I need to split it in three types of parts:
1. contains words starting with number
2. contains words starting with x
3. contains words starting with y
in other words string 'nxy' is to be divided into following parts:
xI
yam yw
1a 2pro
xgr xon xsig
yk yn ya
2h 3h
xpr xoc
yes ysin yn
I need help for:
String[] patterns=nxy.split( ???????????????? );