🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14415

SV: String input from file

#14415
From: Johan Forsberg
Date: Tue, 07 Sep 1999 00:00
28 lines
1368 bytes
John A. Hayes <jahayes@clemson.edu> skrev i
diskussionsgruppsmeddelandet:37D48CBD.18E26527@clemson.edu...
> What is the easiest way to take data from a file and place each sequence
> of characters into a String.  More specifically I would like to take
> data from a file that is in the form:
>
> 01A02  03A41 9
> 02J23  04L23 8
> 01A02  03A41 9
> 02J23  04L23 8
>
> and put it into a two-dimensional String array so that it may later be
> put into a table in the form shown.  Thanks for any and all help in
> advance.
>
> John Hayes

BufferedReader br=new BuffereReader(new FileReader(...));
String row;
int r,c

for (r=0; (row=br.readln())!=null; r++) {
    StringTokenizer st=new StringTokenizer(row);
    for (c=0; st.hasMoreTokens(); c++) {
        array[r][c]=st.nextToken();
    }
}
Technical Details
Message-ID: <7r2s2v$sn49@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37D48CBD.18E26527@clemson.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,37197691e76fff84
X-Google-Attributes: gidf74b3,public
From: "Johan Forsberg" <jfo@SPAM_SPAM_EGGS_SPAMstmf.se>
Subject: SV: String input from file
Date: 1999/09/07
Message-ID: <7r2s2v$sn49@forums.borland.com>
X-Deja-AN: 522050780
References: <37D48CBD.18E26527@clemson.edu>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.language