VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Extract Numerical Values from Text Strings

VB Tips and Source Code  (5 Submissions)   String Manipulation   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

The purpose of this routine is to take a string of text (such as with a textbox) and extract a numerical value from it. let's say that you have a textbox in which people enter dollar amounts. Many users are likely to enter something such as "$ 4,335.49" and expect calculations to be performed on it. The trouble is, the value of that string is 0 (zero), not 4335.49!

Inputs
The function shown below called PurgeNumericInput requires one argument. That argument is a string containing numbers with or without special characters.

Assumes
Using the following function, a person would actually be able to enter a string like "$4,335.49" or even "4335.49 dollars" and still have the value returned as 4335.49.

Rate Extract Numerical Values from Text Strings (4(4 Vote))
Extract Numerical Values from Text Strings.bas

Extract Numerical Values from Text Strings Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters