comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: What's the deal with "slice" in Ada.Strings.Bounded
Date: 1997/07/16
Date: 1997-07-16T00:00:00+00:00	[thread overview]
Message-ID: <dewar.869066680@merv> (raw)
In-Reply-To: 33CBDCDF.751F5ECB@digicomp.com


Jan says

<<So, how would you suggest making a Bounded_String out of this
return value from "Slice"?  In other words, how does one
write, for this case, a function

   function To_Bounded_String( Given_String : in String )
      return Bounded_String is
    ...
   begin
    ...
   end To_Bounded_String ;

where Bounded_String has been given a fixed length by instantiating
"Generic_Bounded_Length".
>>


Well the answer to this is amazingly obvious, and no doubt lots of people
will reply with a specific answer (use To_Bounded_String), but perhaps
more useful is to describe how you could easily have found the answer
to this yourself.

If you are using a package like Bounded_String, then at least read through
the spec to see what routines are there. If you don't understand one of
them, look it up in the RM (the RM is not easy reading in general, but
Annex A is generally quite accessible).

If you do this, you will happen (almost immediately, it is right at the
front) on:

     function To_Bounded_String                                   
       (Source : in String;                                       
        Drop   : in Truncation := Error)                          
        return   Bounded_String;                                  

and you can probably guess how to use this without even needing the RM






      parent reply	other threads:[~1997-07-16  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-15  0:00 What's the deal with "slice" in Ada.Strings.Bounded Jan Galkowski
1997-07-15  0:00 ` Mark Griglock
1997-07-16  0:00 ` Robert Dewar [this message]
replies disabled

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