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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,db8ef2e54cb04ab9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y11g2000yqm.googlegroups.com!not-for-mail From: tonyg Newsgroups: comp.lang.ada Subject: Re: Unbounded String to string Date: Tue, 29 Jun 2010 07:37:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <004d7e0b-cf0a-4a71-ac7e-17b61818b910@5g2000yqz.googlegroups.com> <9eec8378-892b-4299-bde7-4f92535f0c20@x21g2000yqa.googlegroups.com> NNTP-Posting-Host: 89.240.135.62 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1277822242 7179 127.0.0.1 (29 Jun 2010 14:37:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 Jun 2010 14:37:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y11g2000yqm.googlegroups.com; posting-host=89.240.135.62; posting-account=28F2IwkAAACL1Z5nRC-dE7zuvWdbWC7P User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:11986 Date: 2010-06-29T07:37:22-07:00 List-Id: On 29 June, 15:33, Adam Beneschan wrote: > On Jun 29, 7:28=A0am, tonyg wrote: > > > Hi, > > =A0 =A0I have an unbounded string from a database I want to turn into a= 16 > > character subtype of string > > > i.e. unbounded_string to string(1..16) > > > I've been trying to do this most of the afternoon but keep getting > > errors > > > anyone know how ? > > Declare a subtype to give string(1..16) a name; then call To_String > (in Ada.Strings.Unbounded) and convert the function result to your > subtype. =A0E.g.: > > =A0 =A0subtype String_Length_16 is string(1..16); > =A0 =A0V : String_Length_16; > > =A0 =A0V :=3D String_Length_16 (Ada.Strings.Unbounded.To_String (U)); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -- Adam Thanks Adam