取出字符串中的数字
来源:互联网 发布:linux如何创建子目录 编辑:程序博客网 时间:2024/04/29 06:28
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String str = "方圆100公里";
getNumber(str);
}
public String getNumber(String str){
Pattern pattern = Pattern.compile("[0-9]*");
StringBuffer temp = new StringBuffer();
Matcher isNum;
char[] array = str.toCharArray();
for (int i = 0; i < array.length; i++) {
Log.e("value :" + i,"=----"+ array[i]);
isNum = pattern.matcher(array[i]+"");
if(isNum.matches()){
temp.append(array[i]);
}else{
continue;
}
}
Log.e("temp value ", temp.toString());
return temp.toString();
}
}
- 取出字符串中的数字
- iOS---取出字符串中的数字
- iOS---取出字符串中的数字
- iOS---取出字符串中的数字
- 取出字符串中的数字----正则表达式
- 取出字符串中的汉字、字母或是数字
- oracle中取出字符串中的数字
- C#取出字符串中的数字或字母
- 82.取出字符串中的数字字符组成新的字符串
- C#用一个循环[等效]取出字符串中的数字
- 取出字符串中的数字求和(c语言)
- 从字符串中取出数字
- 取出字符串中的年月日
- 取出对象中的字符串
- 取出一个字符串中的所有数字组成一个新的字符串
- sscanf 取出字符串中的数据
- 【叶子函数分享八】取出字符串中的汉字、字母或是数字
- 【叶子函数分享八】取出字符串中的汉字、字母或是数字
- VS2010: Fatal error C1902: Program database manager mismatch; please check your installation
- ARM Linux 3.x的设备树(Device Tree)
- Android 应用签名的创建
- U盘安装win8+Fedora19双系统
- Android----BadgeView使用介绍
- 取出字符串中的数字
- Matlab Codes and Datasets for Feature Learning
- 苹果新手Mac OS X 使用笔记-------- Mac OS X中字体发虚的原因与解决
- 每个人的心里都有两头狼
- vc 找到一个或多个多重定义的符号的解决办法
- Several reasons of why TaxonomySession.DefaultKeywordsTermStore and DefaultSiteCollectionTermStore c
- Android常用界面布局(二)
- RAD 极速应用开发 Spring ROO 入门例子
- Python解非线性方程