Append (función de concatenación de ristras de tamaño limitado)

Explicación

La función Append devuelve la ristra de tamaño limitado resultante de concatenar los parámetros Left y Right. El parámetro Drop indica qué hacer si la ristra resultante es mayor que el tamaño máximo permitido. Puede tomar los valores, declarados en Ada.Strings: Error (lanza la excepción Strings.Length_Error), Left (trunca el extremo izquierdo) o Right (trunca el extremo derecho).

Sintaxis

function Append (Left  : in Ristra_o_Carácter;
                 Right : in Bounded_String;
                 Drop  : in Truncation := Error)
  return Bounded_String;

function Append (Left  : in Bounded_String;
                 Right : in Ristra_o_Carácter;
                 Drop  : in Truncation := Error)
  return Bounded_String;

Ristra_o_Carácter ::= Bounded_String | String | Character

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 Str10 is new Ada.Strings.Bounded.Generic_Bounded_Length(10); use Str10;  
...
SL1, SL2: Str10.Bounded_String;
...
SL1 := To_Bounded_String("Alfa"); --  SL1 = "Alfa"
SL2 := To_Bounded_String("beto"); --  SL2 = "beto"
SL1 := Append(SL1, SL2);          --  SL1 = "Alfabeto"
SL2 := Append(SL1, SL2);          --  ¡ERROR!
SL2 := Append(SL1, SL2, Right);   --  SL2 = "Alfabetobe"
Créditos