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,ae9506fd4dcf7090 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-10 09:05:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Concatenation and Characters Date: Thu, 10 Oct 2002 16:05:17 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <12hp9.796$_u6.380@nwrddc01.gnilink.net> NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1034265917 22005 134.91.1.34 (10 Oct 2002 16:05:17 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Thu, 10 Oct 2002 16:05:17 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: archiver1.google.com comp.lang.ada:29675 Date: 2002-10-10T16:05:17+00:00 List-Id: Justin Birtwell wrote: : How can you declare a string variable when : you don't know before hand what the string is going to be? If you don't known the length, you can't. However, it depends on the extent of "beforehand". Say you arrive at some point in your program where you want to store some text in a string, to be used locally. Then you will have a means (function) to find its length because you know what is going to be stored in the string and declare calculated_length: constant natural := image_length_of (some_data); booklet: constant string(1..calculated_length) := image_of (some_data); begin --- use booklet end; Otherwise you need either bounded strings or unbounded strings, and you will need the operations for them, to store information the way you indicated. The operations are provided by Ada.Strings.* packages, which see, or perhaps some chapter about strings? It's good reading anyway, as (apparently) years of experience in string handling have influenced the design of these packages, and so they are full of useful information. Sometimes it might also be more useful to just not store the information in string variables and instead pass it on to where it is used, via subprogram parameters. -- Georg