Redian新闻
>
how to read formatted text file?
avatar
how to read formatted text file?# Java - 爪哇娇娃
c*g
1
like fscanf("%d %d", &a, &b) in C?
avatar
g*g
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?
avatar
c*g
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.

avatar
g*g
4
How about StringTokenizer

【在 c*****g 的大作中提到】
: any other utils for 1.4.2? thanks a lot.
avatar
c*g
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
avatar
g*g
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.

avatar
m*t
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.

avatar
d*n
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?
avatar
w*n
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.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。