Coding Style: NetBeans IDE 4.0 Beta2 (Java)
Given the following string
String Info = "NAME:ME IP:192.168.0.1 PORT:4444"
I wanted to extract the information from the string using .substring and .indexOf, specifically .Substring(.indexOf("NAME:")+5, .indexOf(" "));
That works GREAT however accessing the rest won't (outofbounds errors): .subString(.indexOf("IP:")+3, .indexOf(" "))
This fails (I think) because my .indexOf(" ") is returning the index of the 1st space (after NAME:ME) and not the next one after IP:192.168.0.1
So how can I make .indexOf jump to the NEXT (" ") character? Or is there a better way to do this?
Any help would be appreciated, Thanks,