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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bf52245c1c52e2e9 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: End of a string???? Date: 2000/10/10 Message-ID: <8rvsj9$m1e$1@nnrp1.deja.com>#1/1 X-Deja-AN: 679850906 References: X-Http-Proxy: 1.0 x73.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Oct 10 20:01:51 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-10-10T00:00:00+00:00 List-Id: In article , Ryuji Yokoyama wrote: > How can I find the end of string in ada? Is there any special > character at the end of line like C's \0? Or is there any function > to find the length of a string like Java's Mystring.length()? I > tried myString'length, but it just gives me the size of array. In Ada the length of the string *is* the length of the array. If you have some kind of logical end of the data within the string, you either have to create your string object exactly that length, or keep track of the end index in a separate variable and use subranges (eg: "MyString(1..MyString_Length)" ). As Tom mentioned, another option is to use Ada.Strings.Unbounded.Unbounded_String or Ada.Strings.Bounded.Bounded_String, which will allow you to use varying-length strings without having to use subranges. But if the string doesn't change after it gets its initial value, you are probably better off just declaring it there with the exact size you will need. For more information on this subject, consult our FAQ at http://www.adapower.com/lab/adafaq/24.html . -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Day 5 of Free Europe Sent via Deja.com http://www.deja.com/ Before you buy.