由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - how to read formatted text file?
相关主题
[转载] 现在还有什么OS不是THREAD级调度的吗?怎样读取修改一个csv file
How is the Jboss AS performance?An experiment with JVM Garbage Collection Schemes
Re: 如何从键盘输入获得一个float值?谢谢!Stack Frame of your JVM implementation
Where I can find comparison of JVMsThe shape of JVM stack frame
新手请教怎样在Java里读文本文件中的内容Top Ten Errors Java Programmers Make(10)
读文件时,如何才能只将空白符当成分隔符?Is this a Bug or not?
请教:parse CSV文件Answer to "Is this a Bug or not? "
Java练习题 4Answer 2 to "Is this a Bug or not? "
相关话题的讨论汇总
话题: formatted话题: fscanf话题: read话题: text
进入Java版参与讨论
1 (共1页)
c*****g
发帖数: 119
1
like fscanf("%d %d", &a, &b) in C?
g*****g
发帖数: 34805
2
java.util.Scanner, you are warned this is since 1.5 implementation.
Don't expect your program running under any JVM lower than 1.5.

【在 c*****g 的大作中提到】
: like fscanf("%d %d", &a, &b) in C?
c*****g
发帖数: 119
3
any other utils for 1.4.2? thanks a lot.

【在 g*****g 的大作中提到】
: java.util.Scanner, you are warned this is since 1.5 implementation.
: Don't expect your program running under any JVM lower than 1.5.

g*****g
发帖数: 34805
4
How about StringTokenizer

【在 c*****g 的大作中提到】
: any other utils for 1.4.2? thanks a lot.
c*****g
发帖数: 119
5
I am using it.
but I've to new a StringTokenizer very time when read a line.
anyway, thanks a lot.

【在 g*****g 的大作中提到】
: How about StringTokenizer
g*****g
发帖数: 34805
6
In that case, you probably want to write a utility class for your own good,
and wrap StringTokenizer in it.

【在 c*****g 的大作中提到】
: I am using it.
: but I've to new a StringTokenizer very time when read a line.
: anyway, thanks a lot.

m******t
发帖数: 2416
7

I don't think StringTokenizer is thread safe, so
the util class would still have to new StringTokenizer everytime.

【在 g*****g 的大作中提到】
: In that case, you probably want to write a utility class for your own good,
: and wrap StringTokenizer in it.

d*****n
发帖数: 76
8
the String method "split()" might be another choice,
but you have to know a bit of regular expression

【在 c*****g 的大作中提到】
: like fscanf("%d %d", &a, &b) in C?
w******n
发帖数: 692
9
Why not consider regex? Though not as convenient as Perl.

【在 c*****g 的大作中提到】
: I am using it.
: but I've to new a StringTokenizer very time when read a line.
: anyway, thanks a lot.

1 (共1页)
进入Java版参与讨论
相关主题
Answer 2 to "Is this a Bug or not? "新手请教怎样在Java里读文本文件中的内容
Java's performance myth读文件时,如何才能只将空白符当成分隔符?
JVM请教:parse CSV文件
Re: system property in javaJava练习题 4
[转载] 现在还有什么OS不是THREAD级调度的吗?怎样读取修改一个csv file
How is the Jboss AS performance?An experiment with JVM Garbage Collection Schemes
Re: 如何从键盘输入获得一个float值?谢谢!Stack Frame of your JVM implementation
Where I can find comparison of JVMsThe shape of JVM stack frame
相关话题的讨论汇总
话题: formatted话题: fscanf话题: read话题: text