我收到java.ArrayIndexOutOfBounds ...我不知道爲什麼。Java拆分字符串ArrayIndexOutOfBounds
private final static String TEST_STRING = "My awesome string !^:_TEEEEEEEEEEEEEST";
public void createPartControl(Composite parent){
String[] temp = TEST_STRING.split("^:_");
System.out.println(temp[0] + " ---> " + temp[1]);
}
編輯:
java.lang.ArrayIndexOutOfBoundsException:1在 com.chriss.cipher.View.createPartControl(View.java:17)在 org.eclipse.ui.internal。 ViewReference.createPartHelper(ViewReference.java:386) 在 org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:240) 在 org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java: 595) at org.eclipse.ui.inter nal.PartPane.setVisible(PartPane.java:315)at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:534)at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart。的java:180) 在 org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270) 在 org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder。 java:65)
可能重複http://stackoverflow.com/questions/10695104/java-split-on-caret-not-working-is-this- A-特殊字符 – Shashi