Topic: 如何判断一个String是否######.##型?

  Print this page

1.如何判断一个String是否######.##型? Copy to clipboard
Posted by: aroundall
Posted on: 2005-05-20 23:23

如题,由于毕业设计里的一段程序涉及到钱币的操作,其中要判断一个输入是否合法的Currency。小弟百思不解,请求大虾们的帮助
boolean isLegal( String s ){
//如何判断s是否######.##型,并且是否一个数字
}

2.Re:如何判断一个String是否######.##型? [Re: aroundall] Copy to clipboard
Posted by: why
Posted on: 2005-05-20 23:28

1. Regular Expression
or
2. java.text.NumberFormat

3.Re:如何判断一个String是否######.##型? [Re: why] Copy to clipboard
Posted by: aroundall
Posted on: 2005-05-21 08:14

谢谢 Why
但Java中正则表达式(Regular Expression)是什么东东?
哪里可以找到相关资料?

4.Re:如何判断一个String是否######.##型? [Re: aroundall] Copy to clipboard
Posted by: why
Posted on: 2005-05-21 08:31

aroundall wrote:
但Java中正则表达式(Regular Expression)是什么东东?
哪里可以找到相关资料?

java.util.regex
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/package-summary.html
http://java.sun.com/docs/books/tutorial/extra/regex/

Jakarta ORO (Perl5 compatible)
http://jakarta.apache.org/oro/

5.Re:如何判断一个String是否######.##型? [Re: aroundall] Copy to clipboard
Posted by: aroundall
Posted on: 2005-05-21 18:47

谢啦


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923