String a="aaa bbb ccc ddd eee ";
String b=a.substring(0,3);
String c=a.substring(4,7);
String d=a.substring(8,11);
String e=a.substring(12,15);
String f=a.substring(16,19);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
System.out.println(f);
——————————————————————————
像这种有特定格式的可以用split更方便
String a="aaa bbb ccc ddd eee ";
String [] b=a.split(" ");
for (int i = 0; i < b.length; i++) {
System.out.println(b[i]);
}
已空格为分隔符截取出一个数组
不准可追问,望采纳
String s="aaa bbb ccc ddd eee".substring(8,"aaa bbb ccc ddd eee".length())