Parsing a string starting from the Right
I have a string where I need to start from the right side and find the first non numeric character and then parse out the numerics.
I would like 12345.
I would like 987.
! would like an empty string.
this is what I am currently doing:
index = 1
str = Mid$(strString, index, 1)
Select Case str
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
strAccNumber = Mid$(strString, index, Len(strString))
index = index + 1
but the problem with this code is that when I get string like:
It returns a string of 5^&*%2345.
Instead of using mid$ how can I start from the right (the last character in the string)?
Try something like:
index = len(strString)
str = mid(strString, index, 1)
if (isnumeric(str) = false) then
str = MID(strString, index + 1)
index = index - 1
loop until index = 0
This is purely "air code", but I think it will work.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL