I just drew on the eclipse IDE and wrote the following code.
String str = new String("A$B$C$D"); String arrStr[] = str.split("$"); for (int i = 0; i < arrStr.length; i++) { System.out.println("Val: "+arrStr[i]); }
I expected an output like: Val: A Val: B Val: C Val: D
But instead, I got a conclusion like
Val: A$B$C$D Why? I think maybe it was interpreted internally as a special input, or it could be as rules for declaring variables.
source share