如何快速去掉单位只取数字?
时间:2011-09-23
来源:互联网
233 元/月
比如这个,只取 前面的 这里是233,但不一定是数字,有可能是其他字符
比如这个,只取 前面的 这里是233,但不一定是数字,有可能是其他字符
作者: phuai007 发布时间: 2011-09-23
substring()截取字符串。。。
作者: zsx841021 发布时间: 2011-09-23
自己写出来了
VB code
VB code
'编辑的时候去掉单位 Function dell_dw(str) str1=split(str," ") dell_dw=str1(0) End function
作者: phuai007 发布时间: 2011-09-23
VBScript code
楼主试试
function getNum(str) Dim re : set re = new RegExp re.Pattern = "[^\d]*" re.IgnoreCase = True re.Global = True getNum = re.replace(str,"") end function str = "233 元/月" response.write getNum(str)
楼主试试
作者: calmcrime 发布时间: 2011-09-23
用正则表达式可以解决
<%
str="233 元/月"
str=strFilter(str)
function strFilter(strsource)
Set obRegexp=New RegExp
obRegexp.IgnoreCase=True
obRegexp.Global=True
obRegexp.Pattern="[^0-9]*"
strsource=obRegexp.Replace(strsource,"")
Set obRegexp = Nothing
strFilter=strsource
end function
%>
<%
str="233 元/月"
str=strFilter(str)
function strFilter(strsource)
Set obRegexp=New RegExp
obRegexp.IgnoreCase=True
obRegexp.Global=True
obRegexp.Pattern="[^0-9]*"
strsource=obRegexp.Replace(strsource,"")
Set obRegexp = Nothing
strFilter=strsource
end function
%>
作者: zhux2003 发布时间: 2011-09-23
楼上都正解~~~~~
作者: enjoy_gw 发布时间: 2011-09-23
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28