comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: type String_Type array(Integer range <>) of Character;
Date: Fri, 16 Apr 2010 22:29:19 +0200
Date: 2010-04-16T22:29:19+02:00	[thread overview]
Message-ID: <hqahb1$tnm$1@news.eternal-september.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1004162257490.8234@medsec1.medien.uni-weimar.de>

stefan-lucks@see-the.signature a �crit :
> Convert S into a variable of type String_Type with String-compatible 
> bounds, and then convert that variable into a String:
> 
>     S : String_Type := "Abc.";
>     T : String_Type(1 .. S'Length) := S;
>     U : String(1 .. S'Length);
>   begin
>      U := String(T); Put_Line(U);  -- or just Put_Line(String(T));
> 
No need for intermediate copy, just use an appropriate subtype:

   S : String_Type := "Abc.";
   T : String(1..4);
   subtype Slide is String_type (T'Range);
begin
   T := String(Slide(S));

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2010-04-16 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 19:52 type String_Type array(Integer range <>) of Character; Warren
2010-04-16 21:09 ` stefan-lucks
2010-04-16 20:29   ` J-P. Rosen [this message]
2010-04-16 20:53     ` Charmed Snark
2010-04-16 20:56     ` Adam Beneschan
2010-04-19 15:27       ` Warren
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox