comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: how to check if a string variable contains a number or string?
Date: Tue, 19 Nov 2002 01:26:43 GMT
Date: 2002-11-19T01:26:43+00:00	[thread overview]
Message-ID: <3DD99344.9020200@acm.org> (raw)
In-Reply-To: a04a773e.0211181241.4e9e13b0@posting.google.com

Sarah Thomas wrote:
> I have an array of strings that I read in from a file. I want to check
> if each element in the array is a string or if it is a number. is
> there any predefined functions that would help do that? thanks

Since you have an array of strings, obviously each element of the array 
is a string. Presumably you mean you want to check if a string contains 
the image of a number or not. In that case, what do you mean by a 
number? An integer value, or a real value? Are embedded underscores 
acceptable? How about an exponent? Based numbers? Does 
"2#0101_1010.0011#E5" represent the image of a number?

Once you've answered these questions you can decide if 'Value or 
something from Ada.Text_IO is acceptable, or if you're going to have to 
write code to parse the string manually.

-- 
Jeff Carter
"Brave Sir Robin ran away."
Monty Python and the Holy Grail




  parent reply	other threads:[~2002-11-19  1:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-18 20:41 how to check if a string variable contains a number or string? Sarah Thomas
2002-11-18 21:09 ` Stephen Leake
2002-11-18 21:50   ` David C. Hoos
2002-11-19  0:44 ` sk
2002-11-19  1:21   ` Jeffrey Carter
2002-11-19  4:41     ` sk
2002-11-19 17:02       ` Jeffrey Carter
2002-11-24  0:10         ` AG
2002-11-23 20:05           ` Jeffrey Carter
2002-11-19  1:26 ` Jeffrey Carter [this message]
2002-11-19  3:19 ` SteveD
2002-11-19  9:38 ` Preben Randhol
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox