Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function to validate string for numeric with decimal point
#8
WhiteTiger,

Many times you have programs which need to get input data from the user, and in many of these cases the data is supposed to be numeric and may or may not have a decimal point.

When you have a requirement for such a numeric input field, your program needs to check it to make sure it's valid. You can't just accept whatever garbage the user keys in. An example would be a field that contains the price of an item. Let's say that the price can have 2 decimal places. Then the following would be valid: 123.45 59.95 149 etc., but you could not allow -123 nor 59.995.
Get it.

So, the function does all the dirty work of validating the input data. There might be additional checking that you might do in addition to using the function, like not allowing a price less than 1.00 or greater that 9999.99, etc.

You've heard the famous term "Garbage in, garbage out". Well if garbage gets into your program or it's files, then the fault is with your program.

What else don't you understand about the specs of the function?

YES, BLANKS ARE SPACES.
*****
Reply


Messages In This Thread
Function to validate string for numeric with decimal point - by Moneo - 07-09-2003, 07:16 AM
To WhiteTiger, Nathan, Agamemnus: - by Moneo - 07-09-2003, 10:28 PM
ah, young one - by Agamemnus - 07-11-2003, 07:08 AM
Re: ah, young one - by oracle - 07-11-2003, 07:13 AM
well..... - by Agamemnus - 07-12-2003, 07:15 AM
Re: well..... - by Moneo - 07-13-2003, 04:59 AM
programming help - by Agamemnus - 07-13-2003, 04:47 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)