How to split String without regex [duplicate]
问题 This question already has answers here : String.split() *not* on regular expression? (8 answers) Closed 5 days ago . In my Java application I need to find indices and split strings using the same "target" for both occasions. The target is simply a dot. Finding indices (by indexOf and lastIndexOf) does not use regex, so String target = "."; String someString = "123.456"; int index = someString.indexOf(target); // index == 3 gives me the index I need. However, I also want to use this "target"