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

Home » Public Forums » archive » Re: type conversion string -> float
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: type conversion string -> float [message #63580] Fri, 14 November 2008 09:17
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
I knew somebody would have written that...

I'll go for valid_num...

Ciao,
Paolo

jigga1...@gmail.com wrote:
> There's also valid_num():
>
> http://idlastro.gsfc.nasa.gov/ftp/pro/misc/valid_num.pro
>
> It's nice cause it'll also check an array of strings too.
Re: type conversion string -> float [message #63581 is a reply to message #63580] Fri, 14 November 2008 09:02 Go to previous message
jigga1206 is currently offline  jigga1206
Messages: 9
Registered: February 2008
Junior Member
There's also valid_num():

http://idlastro.gsfc.nasa.gov/ftp/pro/misc/valid_num.pro

It's nice cause it'll also check an array of strings too.
Re: type conversion string -> float [message #63582 is a reply to message #63581] Fri, 14 November 2008 08:58 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Nov 14, 10:25 am, Paolo <pgri...@gmail.com> wrote:
> Hi,
>
> does anybody have a simple way to find out
> if a string represents a valid float number or not?
>
> For example, it should recognize
> 43
> 123.654773
> 12E-003
> 5.
>
> as valid numbers,
> but should reject
>
> 12B45
> 23-45-2
> 32EE21
> 15$
>
> (Note that float() will happy convert 13A2 but not A132...)
>
> Ciao,
> Paolo

I use Ray Sterner's ISNUMBER()
http://www.astro.washington.edu/deutsch-bin/getpro/library09 .html?ISNUMBER
or http://tinyurl.com/6hgpkv
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: type conversion string -> float
Next Topic: Re: conditional operator

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

Current Time: Wed Oct 08 19:24:26 PDT 2025

Total time taken to generate the page: 0.00563 seconds