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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8fa7a5ee8bce5832 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Associating strings with buffers? Date: 1997/04/11 Message-ID: #1/1 X-Deja-AN: 234249509 References: <5im1cs$kap@basement.replay.com> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-04-11T00:00:00+00:00 List-Id: In article <5im1cs$kap@basement.replay.com>, Harold Hoes wrote: >Is there a predefined package to associate strings with buffers? >Thanks in advance. I don't know what you mean. There are some string buffer packages, though: Ada.Strings.Fixed Ada.Strings.Bounded Ada.Strings.Unbounded Is that what you want? Here's a lower-level way of associating a string with a buffer: subtype Length_Range is Natural range 0 .. 132; type String_Buffer (Length : Length_Range := 0) is record Text : String (1 .. Length); end record; function "+" (R : String) return String_Buffer is begin return (R'Length, R); end; So you can do this: Send_Pete_To_Town: declare The_String : String_Buffer; begin The_String := +"how now brown cow"; The_String := +"Goodbye Sister Disco"; The_String := +"don't cry, don't say goodbye, it's only teenage wasteland"; Text_IO.Put_Line (The_String.Text); end Send_Pete_To_Town; Of course, type Ada.Strings.Bounded is prefered for this sort of thing. I show this technique because it's sometimes useful for other kinds of arrays. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271