Article View: borland.public.jbuilder.java.language
Article #483Re: How to split a String?
From: Lori M Olson [TeamB]
Date: Tue, 19 Apr 2005 14:36
Date: Tue, 19 Apr 2005 14:36
43 lines
2022 bytes
2022 bytes
Vander wrote:
> csicentury wrote:
>
>> I want to get "14.pdf" from string "d:\uintapp\search\info\14.pdf",
>> but how to implement?
>> my jdk is 1.3
>>
>> Thanks
>> Century
>>
>>
>
> I guess the only cross-platform implementation is
>
> String path = "d:\uintapp\search\info\14.pdf";
> String name = new File( path ).getName();
>
> This should return at least an empty string (if path has no filename).
>
> - Vander
String.substring() with String.lastIndexOf( File.separatorChar ) should
work.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<4265179b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4264bac7@newsgroups.borland.com> <4264cb03$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,9b8a0edae9b6ee0b X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 19 Apr 2005 08:36:32 -0600 From: "Lori M Olson [TeamB]" <javadragon@techie.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax;nscd1) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: How to split a String? References: <4264bac7@newsgroups.borland.com> <4264cb03$1@newsgroups.borland.com> In-Reply-To: <4264cb03$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 142.179.181.200 Message-ID: <4265179b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1113921435 142.179.181.200 (19 Apr 2005 07:37:15 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail