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,754e583fcabdfad2,start X-Google-Attributes: gid103376,public From: michael@ifr.luftfahrt.uni-stuttgart.de (Michael Paus) Subject: Re: Help Date: 1996/11/15 Message-ID: <56hd39$nu6@info4.rus.uni-stuttgart.de>#1/1 X-Deja-AN: 196619863 references: <328C2BF5.1348@informatik.tu-muenchen.de> organization: Comp.Center (RUS), U of Stuttgart, FRG newsgroups: comp.lang.ada Date: 1996-11-15T00:00:00+00:00 List-Id: "Alexander B. Schmidt" wrote: > Hi, > > does anybody know how to declare a string of variable length in Ada > 83? Declaring a variable of type String like > str: STRING(1..20); > and assigning a string like > str := "a String" > results in a constraint error if the length of the string is not equal > to 20. > Is it possible to declare strings with a maximum length which accept > the assignment of shorter strings too? Well, there is nothing like a variable length string in Ada 83 directly. A string is an array of characters and it does not make much sense to assign arrays of different sizes to each other. To solve this problem you can use one of the available string handling packages, or you could switch from Ada 83 to Ada 95 and use the standard package Ada.Strings.Unbounded. (Look at http://www.adahome.com/ to see what is all available for Ada) Michael -- ------------------------------------------------------------------------ --Dipl.-Ing. Michael Paus (Member: Team Ada) --University of Stuttgart, Inst. of Flight Mechanics and Flight Control --Forststrasse 86, 70176 Stuttgart, Germany --Phone: (+49) 711-121-1434 FAX: (+49) 711-634856 --Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)