asp提取字符串中的数字,比如“87-78”截取87,78,“102-120”截取102,120
3个回答
展开全部
<%
方法1(用分割函数然后再重新拼接):
strNum = "87-78"
arrStr = Split(strNum,"-") '分割函数Split
For i = LBound(arrStr) To UBound(arrStr)
Response.Write("返回值数组中的元素[" & i & "]:" & arrStr(i)
Next
方法2(直接用替换函数把"-"换成","):
strNum = "87-78"
Response.Write(Replace(strNum,"-",",")) '替换函数Replace
%>
方法1(用分割函数然后再重新拼接):
strNum = "87-78"
arrStr = Split(strNum,"-") '分割函数Split
For i = LBound(arrStr) To UBound(arrStr)
Response.Write("返回值数组中的元素[" & i & "]:" & arrStr(i)
Next
方法2(直接用替换函数把"-"换成","):
strNum = "87-78"
Response.Write(Replace(strNum,"-",",")) '替换函数Replace
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询