comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Testing validity of numerical content of a string
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Testing validity of numerical content of a string [message #51743 is a reply to message #51742] Wed, 06 December 2006 17:38 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Y.T. writes:

> Maybe this is a stupid question, but is there a way in IDL to tell
> whether a string contains a valid representation of a particular data
> type? For example an integer? I can do something like
>
> test = fix(str)
>
> which will return zero (and throw an error message) if str is, say,
> "hello". But is there a way to tell whether type conversion of a string
> will work if attempted?
>
> Anybody have something clever at hand?

Clever's not really my thing. You would have to go to JD
for that. But FSC_FIELD has a neat little function named
"VALIDATE" that validates whether a string is a float or
double or an integer, whatever it is suppose to be. You
might be able to steal that and do something clever with
it. :-)

http://www.dfanning.com/programs/fsc_field.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Adjacent plot question
Next Topic: Logarithmic Binning with Histogram function?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:53:48 PDT 2025

Total time taken to generate the page: 0.00407 seconds