Java: String and using the split function?
OK, Im trying to split a string containing an IP Address into the 4 byte address.
Here is my code:
getIP(String st){ //st contains "192.168.1.21"
String[] var = st.split(".");
...
After the split, var has a length of 0. WHY???
If I change it to:
String[] var = st.split("1");
...
I get what I would expect with var having a length of 4 and each string containing:
var[0] = ""
var[1] = "92."
var[2] = "68."
var[3] = ".2"
Can you not use the dot (.) character to split a string???