Re: Datatype checking in DotNET
- From: "Daniel Hobson" <djhob1972@xxxxxxxxxxxx>
- Date: Fri, 29 Jun 2007 08:59:14 GMT
You can use a function called StrToFloat (There is other variations of this function also ie. StrToFloatF)
"Nicholas Sherlock" <N.sherlock@xxxxxxxxx> wrote in message news:f62ggo$i9o$1@xxxxxxxxxxxxxxxxxx
I've never seen DotNet, but there is probably some method of a Double class, for instance, that attempts a conversion from a string to a double and will throw an error or give a return code if the string isn't a valid double.
Hi Nicholas,
Hi Nicholas,
Yeah I am doing that now at the moment for example as based on the given example previously:-
I use StrToFloat, if this fails, it raises an exception (Which is fine of course).
But what I am trying to achieve here is to ensure the data integrity, does the data meet the float bounds?????
For integers you could do a test like this:-
tempVal := StrToInt (fieldStr);
if (tempVal < low (IntImSavingToo )) or (tempVal > high (IntImSavingToo )) then
exit;
IntImSavingToo := tempVal;
Is there something I can use for floats, doubles and singles also???
Daniel.
.
- Follow-Ups:
- Re: Datatype checking in DotNET
- From: Hans-Peter Diettrich
- Re: Datatype checking in DotNET
- References:
- Datatype checking in DotNET
- From: Daniel Hobson
- Re: Datatype checking in DotNET
- From: Nicholas Sherlock
- Datatype checking in DotNET
- Prev by Date: Re: Datatype checking in DotNET
- Next by Date: Re: Datatype checking in DotNET
- Previous by thread: Re: Datatype checking in DotNET
- Next by thread: Re: Datatype checking in DotNET
- Index(es):
Relevant Pages
|