> Try this as well and see the String API for details on split(String)> // String str = "folder/file.xxx"
> String s = str.split("\\.")[0];
> #
But that would split the name on *every* dot, e.g. "/u/jos/foo.bar.text"
would become [ "/u/jos/foo", "bar", "text" ]
My bet's on something like this:String noExtension(String name) {
int dot= name.lastIndexOf('.');
return (dot < 0)?name:name.substring(0, dot);
}
kind regards,
Jos
> >But that would split the name on *every* dot, e.g. "/u/jos/foo.bar.text"
> >would become [ "/u/jos/foo", "bar", "text" ]
>
> True. Concentrated a bit too much on the example at hand. It seems I
> have a hard time thinking out of the box today. =)
No need to worry; it's Sunday after all ;-)
kind regards,
Jos