From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,212740d5951bd181 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-24 16:56:52 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3B367E2B.D5F4A7F3@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: String handling??? References: <3B362243.EA4AA94E@ida.his.se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 24 Jun 2001 23:56:52 GMT NNTP-Posting-Host: 158.252.147.84 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 993427012 158.252.147.84 (Sun, 24 Jun 2001 16:56:52 PDT) NNTP-Posting-Date: Sun, 24 Jun 2001 16:56:52 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sun, 24 Jun 2001 16:54:41 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:9081 Date: 2001-06-24T23:56:52+00:00 List-Id: Michael Andersson wrote: > > 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. Assuming that "extract numbers" means convert from a text representation in a String into the internal representation for a numeric type, you have a number of options. If your String contains a single value, possibly with leading or trailing blanks, you can use the 'Value attribute. See your text or ARM Annex K. For more complex situations, there are procedures in Ada.Text_IO that "read" from a string. See your text or ARM Annex A.10. For parsing Strings, you might find the subprograms in Ada.Strings.Fixed useful. See your text or ARM Annex A.4.3. The other child packages of Ada.Strings might also be of interest. However, none of these work exactly like sprint (if that really is a C function for extracting numbers from a string). In general, Ada Strings do not work like C strings. If that really is a requirement, you'll have to write your own or import the C functions. -- Jeff Carter "Hello! Smelly English K...niggets." Monty Python & the Holy Grail