Bounded_Slice (función de selección de una subristra)

Explicación

La función Bounded_Slice devuelve el trozo de la ristra Source comprendido entre Low y High. Lanza Index_Error si Low > Length (Source) o High > Length(Source).

Sintaxis

function Bounded_Slice (Source : in Bounded_String;
                Low    : in Positive;
                High   : in Natural)
  return Bounded_String;
procedure Bounded_Slice (Source : in Bounded_String;
                         Target :    out Bounded_String;
                         Low    : in Positive;
                         High   : in Natural);

Ejemplo

-- En Ada.Strings están definidas algunas constantes
-- como Error, Left y Right.
with Ada.Strings; use Ada.Strings
with Ada.Strings.Bounded;   --  Librería de ristras de tamaño limitado
...
package Str100 is new Ada.Strings.Bounded.Generic_Bounded_Length(100); use Str100;  
...
SL1, SL2: Str100.Bounded_String;
...
SL1 := To_Bounded_String ("Escuela Universitaria de Informática");
SL2 := Bounded_Slice(SL1, 9, 19));  --  SL2 = "Universitar"
Créditos