Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting text to Numeric and Date fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00167407
Message ID:
00167422
Vues:
21
>> Can you try and convert it into a temp var and see if it converts?
>
>Michelle,
>
>That's what I am attempting, but VFP will proceed with the conversion and not have a problem. To further illustrate, if in the command window, you enter:
>
>?VAL('ABC')
>
>You get zero. My question is how do I test 'ABC' to see if it is really valid numeric data. Otherwise how do I distinguish between zero and 'ABC'?
>
>Thanks for the suggestion.
>
>Kind Regards,
>
>Mat Kennedy
>Decision Support Technology Inc.

Well, this isn't fast, but it would work... (In theory, anyway)
FOR i = 1 TO LEN(lcString)
   lcChar = SUBSTR(lcString,i,1)
   IF NOT ISDIGIT(lcCHar) AND NOT INLIST(lcChar,"-",".")
      llNumber = .F.
   ENDIF
ENDFOR

IF llNumber
   MESSAGEBOX("It's a number")
ENDIF
My brain is taking a siesta at the moment, so please pardon me if I goofed up there... :)

-Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform