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-Thread: 103376,433c69d8e0b09b09 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!news.glorb.com!atl-c08.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!ALLTEL.NET-a2kHrUvQQWlmc!not-for-mail Date: Wed, 31 Aug 2005 13:11:57 -0500 From: "Marc A. Criley" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: String References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <9dca7$4315f2f7$49953ba$30842@ALLTEL.NET> X-Complaints-To: abuse@usenetserver.com Organization: UseNetServer.com X-Trace: 9dca74315f2f7a13cf61f30842 Xref: g2news1.google.com comp.lang.ada:4345 Date: 2005-08-31T13:11:57-05:00 List-Id: Frode Tenneb� wrote: > On Wednesday 31 August 2005 18:52 TC wrote: > >>there is a function that calculate string lenght? > > 'Length > >>how use that? > > Foo : constant String := "bar"; > Len : Integer := Foo'Length; -- Len=3 This is of course correct so long as one is using fully filled-out string values. (Frode, I know you know all of the following, I'm just adding to it for the benefit of TC :-) Ada does not implicitly support the C approach of treating strings as an array of characters terminating with a null (0). So you can't use Ada's strings the same way you would C's strings. If you are going to need variable length strings, the Ada.Strings.Unbounded package will probably meet your needs. If you really need C-style strings, such as when interfacing to a C library, you can use the Interfaces.C.Strings package. It has a Strlen function that can be applied to its definition of C strings. (Both of these packages are part of the standard Ada distribution.) Or you can write your own package to manage strings the way that you want. But given the ready availability of the above string packages, there's really little to be gained by doing so, unless you have some special needs that you have to live with, e.g., hard real-time. -- Marc A. Criley -- McKae Technologies -- www.mckae.com -- DTraq - XPath In Ada - XML EZ Out