摘要: 下面有四种方法,估计好用的应该是第三种吧。1.用JAVA自带的函数 public static boolean isNumeric(String str){ for (int i = str.length();--i>=0;){ if (!Character.isDigit(str.charAt(i))){return false; } }return true; } 2.正则表达式 public static boolean isNumeric(String str){ Pattern pattern = Pattern.compile("[0-9]*"); ret 阅读全文
posted @ 2012-11-16 10:17 刀锋浪 阅读(795) 评论(0) 推荐(0)
摘要: TextInput有个属性叫restrict,设置该属性即可。例如:只允许输入数字和负号:<s:TextInput id="textinput_LOGOLeftW" restrict="0-9\-\+" />只允许输入数字和点号:<mx:TextInput id="txt" restrict="0-9\." />只允许输入数字、英文、汉字:<mx:TextInput restrict="0-9\a-z\^{'[\u4e00-\u9fa5]'}"/&g 阅读全文
posted @ 2012-11-16 10:16 刀锋浪 阅读(292) 评论(0) 推荐(0)