By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,318 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,318 IT Pros & Developers. It's quick & easy.

reading formatted input

P: 1
i'd like to read a formatted text file with three variables .eg.

1.089 A

where var1=1.0, var2=89, var3=" ", var4=A

please provide a sample code.
Mar 28 '07 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
i'd like to read a formatted text file with three variables .eg.

1.089 A

where var1=1.0, var2=89, var3=" ", var4=A

please provide a sample code.
Read this and this and post if you get any other problems.
Mar 29 '07 #2

P: 1
//written in java
String st="1.0 89 A";
Scanner scan=new Scanner(st);
float var1=scan.nextFloat();
int var2=scan.nextInt();
String var3=scan.nextLine();
System.out.printf("var1=%f,var2=%d,var3=%s\n",var1 ,var2,var3);
Aug 1 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.