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,5a1c0a6cbd361842 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s71.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is there an end of string like in C References: <1151691630.276880.203280@75g2000cwc.googlegroups.com> In-Reply-To: <1151691630.276880.203280@75g2000cwc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.176 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s71 1151698340 12.201.97.176 (Fri, 30 Jun 2006 20:12:20 GMT) NNTP-Posting-Date: Fri, 30 Jun 2006 20:12:20 GMT Date: Fri, 30 Jun 2006 20:12:20 GMT Xref: g2news2.google.com comp.lang.ada:5353 Date: 2006-06-30T20:12:20+00:00 List-Id: Chris L wrote: > In C, there is an end of string character ('\0'). Is there one in Ada? > Can you give me code that checks for it in an array? In Ada, a string type is a one-dimensional array type with components of a character type. You can define your own character types and your own string types. If you want to define your own end-of-string character and a library of operations that know about that character you certainly can. The predefined type Character is a character type. The predefined type String is a string type. Its definition is type String is array (Positive range <>) of Character; pragma Pack (String); The definitions of Character and String do not define an end-of-String Character or any operations that treat a Character as such. The C approach is referred to in Ada as a bounded string; the logical value can vary in length from zero to some maximum number of characters. You can also consider an unbounded string, in which there is no upper limit to the length (except as imposed by available storage). You might want to look at Ada.Strings.Bounded and Ada.Strings.Unbounded for the Ada Way to do this sort of thing. One advantage of the Ada Way is that all characters can be elements of a string. This is all pretty basic and should be covered by any text or tutorial, which you should have worked through before asking questions such as this. You can find on-line texts and tutorials at www.adapower.com and www.adaworld.com. -- Jeff Carter "The time has come to act, and act fast. I'm leaving." Blazing Saddles 36