码迷,mamicode.com
首页 > 其他好文 > 详细

正则取小数点后面几位

时间:2018-10-31 22:36:50      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:www.   function   ext   fun   cti   tps   on()   $1   new   

【转自】正则表达式取小数点后面几位

<script type="text/javascript">
onload = function(){
    var a = "23.456322";
    var aNew;
    var re = /([0-9]+\.[0-9]{2})[0-9]*/;
    aNew = a.replace(re,"$1");
    alert(aNew);
}
</script>

正则取小数点后面几位

标签:www.   function   ext   fun   cti   tps   on()   $1   new   

原文地址:https://www.cnblogs.com/liyuspace/p/9886293.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!