I have a string (which is basically a file name following a naming convention) abc.def.ghi
abc.def.ghi
I would like to extract the substring before the first
How about using regex?
String firstWord = filename.replaceAll("\\..*","")
This replaces everything from the first dot to the end with "" (ie it clears it, leaving you with what you want)
Here's a test:
System.out.println("abc.def.hij".replaceAll("\\..*", "");
Output:
abc