shorten java output

how can i call this function to return data without last 4 characters (.xxx)+attribs["title"]+Thanks for help
[130 byte] By [marcgpxa] at [2007-11-26 18:47:38]
# 1
What?
duckbilla at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 2
I need to change function to return data without last 4 charactersI need:folder/filenow i get:folder/file.xxxCan i change that when i call it? with some parameter?
marcgpxa at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 3
String.substring(....);
camickra at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 4
Can you please give me more detail on that?Thanks
marcgpxa at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 5
> Can you please give me more detail on that?Also have a look at the String.lastIndexOf(...) method; hint searchfor the last dot.kind regards,Jos
JosAHa at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 6
Try this as well and see the String API for details on split(String)// String str = "folder/file.xxx"String s = str.split("\\.")[0];#
duckbilla at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 7

> 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

JosAHa at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 8
>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. =)#
duckbilla at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...
# 9

> >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

JosAHa at 2007-7-9 6:21:35 > top of Java-index,Java Essentials,Java Programming...