Topic: 怎么把string中的数字读出来? |
Print this page |
1.怎么把string中的数字读出来? | Copy to clipboard |
Posted by: Butterfly_125 Posted on: 2005-07-24 16:27 问个很菜的问题:(自己就是一直没有想出来) 比如说有:String s = ("adfasd12342ds"); 怎样才可以只读出其中的数字? |
2.Re:怎么把string中的数字读出来? [Re: Butterfly_125] | Copy to clipboard |
Posted by: why Posted on: 2005-07-24 21:44 Regular Expression java.util.regex http://javaalmanac.com/egs/java.util.regex/GroupInPat.html pattern for the number is: \d+ |
3.Re:怎么把string中的数字读出来? [Re: Butterfly_125] | Copy to clipboard |
Posted by: 1047 Posted on: 2005-08-05 10:21 这得一个一个的处理了吧 除非是全是数字的可以用函数来直接转换
|
4.Re:怎么把string中的数字读出来? [Re: Butterfly_125] | Copy to clipboard |
Posted by: andaywgz Posted on: 2005-08-05 10:27 你可以用字符串类的类函数啊 |
5.Re:怎么把string中的数字读出来? [Re: Butterfly_125] | Copy to clipboard |
Posted by: xunloveru Posted on: 2005-08-09 09:58 The best method is why's
|
6.Re:怎么把string中的数字读出来? [Re: Butterfly_125] | Copy to clipboard |
Posted by: ranchgirl Posted on: 2005-08-09 21:07 To xunloveru Your code is good, but my suggestion is using StringBuffer instead of String in this case.
|
7.Re:怎么把string中的数字读出来? [Re: gongshi] | Copy to clipboard |
Posted by: ww1ww1 Posted on: 2005-08-09 22:39 gongshi wrote: Maybe StringBuilder is better. |
8.Re:怎么把string中的数字读出来? [Re: ww1ww1] | Copy to clipboard |
Posted by: why Posted on: 2005-08-10 01:00 ww1ww1 wrote: StringBuilder is good, but it is only available in Java 5.0 |
9.Re:怎么把string中的数字读出来? [Re: why] | Copy to clipboard |
Posted by: ww1ww1 Posted on: 2005-08-11 01:09 why wrote: |
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 |