Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
' do it with a regular expression (RegExp).
' your input is named str.
' two ways of using a regexp to "cast" this
' input to an int are provided.
Dim str, objReg, objMatches
Set objReg = New RegExp
objReg.Global = True
' this first example strips anything matching the
' pattern (a decimal followed by 0 or more numbers)
' by using the "Replace" method of the RegExp
str = "12.25"
objReg.Pattern = "\.\d*"
str = objReg.Replace(str, "")
response.write "new value is " & str & "<br>"
' this next example simply shows another way to
' "pick" out what you want from a string.
' the usage here "captures" the first parenthesized
' pattern (\d+) by using the "Execute" method and the
' "submatches" collection -- the pattern used is one
' or more numbers, possibly followed by a decimal
' plus one or more numbers.
str = "12.25"
objReg.Pattern = "(\d+)(\.\d*)?"
Set objMatches = objReg.Execute(str)
str = objMatches(0).Submatches(0)
response.write "new value is " & str & "<br>"