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: a07f3367d7,27544cb48c942326 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.156.195 with SMTP id y3mr89758bkw.4.1319770509118; Thu, 27 Oct 2011 19:55:09 -0700 (PDT) Path: l23ni1876bkv.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!feed.xsnews.nl!border-2.ams.xsnews.nl!upload-1.xsnews.nl!10.10.60.4.MISMATCH!frontend-F10-04.ams.news.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada References: <4ea68441$0$8041$703f8584@textnews.kpn.nl> In-Reply-To: Subject: Re: Length of unbounded_string. Date: Fri, 28 Oct 2011 04:54:01 +0200 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Message-ID: <4eaa1951$0$3312$703f8584@news.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1319770449 news.kpn.nl 3312 77.168.179.107@kpn/77.168.179.107:64168 Xref: news2.google.com comp.lang.ada:14215 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit Date: 2011-10-28T04:54:01+02:00 List-Id: The output is the same in the command window of Windows 7 "Jeffrey Carter" schreef in bericht news:j871dj$9td$1@tornado.tornevall.net... On 10/25/2011 02:37 AM, ldries46 wrote: > I just found the following extra relevant points: > Instead of I put in the line "x " > & Next_Line;> > This showed that with Str := "str," en Next_Line := "Next" the output > became > "str x Next" > When I changed Str to Str := "strx" the output changed to "strxx Next" > This looks like the comma has a special meaning within an Unbounded String No Character has a special meaning in a String or an Unbounded_String. This appears to be a problem with the way you're viewing the contents. with Ada.Strings.Unbounded; with Ada.Text_IO; procedure US_Test is use Ada.Strings.Unbounded; Str_Start : constant Unbounded_String := To_Unbounded_String ("str,"); Next_Line : constant Unbounded_String := To_Unbounded_String ("Next"); Str : Unbounded_String := Str_Start; begin -- US_Test Str := Str & " " & Next_Line; Ada.Text_IO.Put_Line (Item => '>' & To_String (Str) & '<'); Str := Str_Start; Str := Str & "x " & Next_Line; Ada.Text_IO.Put_Line (Item => '>' & To_String (Str) & '<'); Str := To_Unbounded_String ("strx"); Str := Str & "x " & Next_Line; Ada.Text_IO.Put_Line (Item => '>' & To_String (Str) & '<'); end US_Test; jrcarter@jrcarter-gateway-1:~/Code$ gnatmake -gnaton -O2 -j2 us_test.adb gcc-4.4 -c -gnaton -O2 us_test.adb gnatbind -x us_test.ali gnatlink us_test.ali jrcarter@jrcarter-gateway-1:~/Code$ ./us_test >str, Next< >str,x Next< >strxx Next< This is GNAT 4.4.5 on Ubuntu 11.04. If this program gives different results on your system, let us know. -- Jeff Carter "Blessed are they who convert their neighbors' oxen, for they shall inhibit their girth." Monty Python's Life of Brian 83