文选流氓 发表于 2003-2-7 01:36

1-1-19-29 怎么获取一个字符串中的数字?

发信人: myzdf (myzdf), 信区: Java      
标题: Re: 怎么获取一个字符串中的数字?
发信站: BBS 水木清华站 (Mon Aug 19 12:52:36 2002)


java.util.Properties props = new java.util.Properties();
java.io.FileInputStream fis
   = new java.io.FileInputStream("your txt file full path");
props.load(fis);
fis.close();

// get the http
String http = props.getProperty("http");
int port = Integer.parseInt(props.getProperty("port","1234"));


【 在 weige (红烛无泪) 的大作中提到: 】
: 我想从一个txt文件中读取,文件格式如下:
: http=10.0.0.1
: port=1234
: ...
: 读取之后,我想获得这些数字(值)
页: [1]
查看完整版本: 1-1-19-29 怎么获取一个字符串中的数字?