comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
To: <comp.lang.ada@ada.eu.org>
Cc: <a98mican@ida.his.se>
Subject: Re: String handling???
Date: Sun, 24 Jun 2001 07:30:34 -0500
Date: 2001-06-24T07:30:34-05:00	[thread overview]
Message-ID: <mailman.993385910.11527.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 3B362243.EA4AA94E@ida.his.se

There is no sprint function in any C library of which I am aware.  You are
probably thinking of sprintf, but even that function is of no help in
extracting
numbers from a string.  To do that, in C, one would use scanf, or one of its
companion xscanf functions.

That said, to do the same thing in Ada, one would make use of the 'Value
attribute of the corresponding numeric type to obtain the numeric
value from its string representation.

For example, to obtain the numeric value from a string of digits, one
would use the Integer'Value function, passing the string as the argument.

To tokenize a string (say, from a file), one would use the Find_Token
procedure of the Ada.Strings.Fixed package.

----- Original Message -----
From: "Michael Andersson" <a98mican@ida.his.se>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: June 24, 2001 12:24 PM
Subject: String handling???


> Hi!
> I'm currently trying to write a text file parser from my collage project
> and I'm looking for some functions i Ada that works like the sprint
> function in C. Is there such a function?
> The thing is that I want to extract numbers from a string and I don't
> know how.
>
> Need your help, please!
> /Michael Andersson
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>




  parent reply	other threads:[~2001-06-24 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-24 17:24 String handling??? Michael Andersson
2001-06-24 12:30 ` Dale Stanbrough
2001-06-24 12:30 ` David C. Hoos, Sr. [this message]
2001-06-24 12:49 ` Larry Kilgallen
2001-06-24 23:56 ` Jeffrey Carter
replies disabled

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