Topic: 判断是否为数值数据 |
Print this page |
1.判断是否为数值数据 | Copy to clipboard |
Posted by: wslss007 Posted on: 2005-11-02 12:18 以下代码是判断是否为数值数据: for(int i=1;i<args[0].length();i++){ ch=args[0].charAt(i); if(!Character.isDigit(ch))} throw new NumberFormatException();}} 我是初学者,看不大懂,是要先记下来呢?还是以后会学到类似的知识。 以后贴代码的时候,把<禁止在这个帖子中使用笑脸标记>这个选项钩上 |
2.Re:判断是否为数值数据 [Re: wslss007] | Copy to clipboard |
Posted by: bluecrystal Posted on: 2005-11-02 12:37 判断方法很多的 这个也算是一种把 |
3.Re:判断是否为数值数据 [Re: wslss007] | Copy to clipboard |
Posted by: Jcat Posted on: 2005-11-02 14:32 1.命令行参数 2.Character类 3.异常处理(抛出异常) 弄清楚这三个问题,你应该就能看懂你的代码了。 前两个比较简单,第三个稍微花点功夫 :) |
4.Re:判断是否为数值数据 [Re: wslss007] | Copy to clipboard |
Posted by: wslss007 Posted on: 2005-11-02 15:08 i have never learn the class character .which chapter is it in? |
5.Re:判断是否为数值数据 [Re: wslss007] | Copy to clipboard |
Posted by: Jcat Posted on: 2005-11-02 15:40 The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char. In addition, this class provides several methods for determining a character's category (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase and vice versa. 你可以在一些IDE的帮助文档,或直接在JDK documentation里找到各种类的详细用法及讲解。 上述摘引在JBuilder的帮助和JDK文档里都有。 |
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 |