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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How to get this space away? Date: Wed, 03 Jun 2015 20:30:26 +0100 Organization: A noiseless patient Spider Message-ID: References: <32d031b4-f8ce-4ed5-a066-c5f4a2a1d526@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="2c7d8f71a176d2eaa78ec9fbd86e1d4a"; logging-data="18277"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kZHU8jmmhLveNje4MJbIJHpsVRCdrOWY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:HmbKcPY3jEAcMMncWkFpPSeS9UA= sha1:5w9EWBGHVosDINrUqQA2AHo9en0= Xref: news.eternal-september.org comp.lang.ada:26165 Date: 2015-06-03T20:30:26+01:00 List-Id: Laurent writes: > On Tuesday, June 2, 2015 at 10:53:30 PM UTC+2, Simon Wright wrote: > >> and instead you need to provide something like >> >> function "+" (R : String) return Bounded_String is >> begin >> return To_Bounded_String >> (Ada.Strings.Fixed.Trim (R, Ada.Strings.Both)); >> end "+"; > > Thanks that works. Just don't understand the detour via fixed strings > and the Ada.Strings.Both R is a fixed-length string, so the corresponding string operations are in Ada.Strings.Fixed. For Ada.Strings.Fixed.Trim see ARM A.4.3(89) [1]. There are also Trims for Bounded and Unbounded strings, which is why Both is declared in Ada.Strings. I think trimming the fixed string R to start with may well be the more efficient, but I haven't checked. [1] http://www.ada-auth.org/standards/12rm/html/RM-A-4-3.html#p89