Article View: borland.public.jbuilder.java.language
Article #14960Re: Sort Function / Class
From: John R. Collins
Date: Wed, 21 Jul 1999 00:00
Date: Wed, 21 Jul 1999 00:00
28 lines
1803 bytes
1803 bytes
Ivo Sturyenegger <ivosturzenegger@bluewin.ch> wrote in message news:37791BAC.8A6F33CA@bluewin.ch... > However, I have to programm a sort function, which I can search for a certain string > in a file. Now anybody tell how I can program such a class, are there any samples > one the Internet available ? I am looking forward to hearing from you soon. JBuilder comes with a sample "sort" program that provides 3 different kinds of sorts, and demonstrates them doing their job graphically. So if you load all the lines of the file into memory that will work. Or you could use JPython, and in 3 lines of code you could: open the file, read all the lines of code into a list, and sort the entire list. One more line of code would then let you print the entire list. And JPython is 100% Pure Python and is embeddable in Java programs so who would know? You can grab JPython from www.jpython.org As far as searching goes, check out the methods provided in the java String class if you are searching within each line. Or if searching for a particular line consider checking it on read, or after the fact by storing it in a Hashtable in Java or dictionary in JPython and then doing a lookup. John Collins
Technical Details
Message-ID:
<7n4cv5$k071@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7jjprj$40p16@forums.borland.com> <37636453.53715CC7@bluewin.ch> <37791BAC.8A6F33CA@bluewin.ch>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,e47d1348b2d1802 X-Google-Attributes: gidf74b3,public From: "John R. Collins" <johnrobertcollins@erols.com> Subject: Re: Sort Function / Class Date: 1999/07/21 Message-ID: <7n4cv5$k071@forums.borland.com> X-Deja-AN: 503501501 References: <7jjprj$40p16@forums.borland.com> <37636453.53715CC7@bluewin.ch> <37791BAC.8A6F33CA@bluewin.ch> Organization: Another Netscape Collabra Server User X-Mimeole: Produced By Microsoft MimeOLE V5.00.2314.1300 Newsgroups: borland.public.jbuilder.java.language