Trim Non-numeric Characters Using ASCII

Category:
C#, VB.NET, ASP.NET
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic.NET

More information:
This function loops through each character passed in and compares the value to that of the ASCII numbers 47-58, which are equivalent to numbers 0-9, using the Asc() function. Anything that doesn't match is stripped from the string.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: