xyz xyz - 2 months ago 6
Java Question

In java how to get substring from a string till a character c?

I have a string (which is basically a file name following a naming convention)


I would like to extract the substring before the first
(ie a dot)

In java doc api, I can't seem to find a method in String which does that.

Am I missing something? How to do it?


look at String.indexOf and String.substring.

Make sure you check for -1 for indexOf.