Ada Programming/Delimiters/*

Arithmetic Multiplication
The "*" operator is defined as arithmetic multiplication for all numeric types.

"*" (Left, Right : T) T;

Usage
A : Float   := 5.0 * 2.0; B : Integer := 5 * 2;

Working Example
; Operator_Multiply A : Float   := 5.0 * 2.0; B : Integer := 5 * 2; T_IO Ada.Text_IO; F_IO   Ada.Text_IO.Float_IO (Float); I_IO   Ada.Text_IO.Integer_IO (Integer); T_IO.Put ("A = "); F_IO.Put (      Item => A,       Fore => 3,       Aft  => 1,       Exp  => 0); T_IO.New_Line; T_IO.Put ("B = "); I_IO.Put (      Item  => B,       Width => 3,       Base  => 10); T_IO.New_Line; Operator_Multiply;

Character replication
A String is created where a single character is replicated n-times.

"*" (Left : Natural; Right : Character) String;

In addition to standard Strings this operator is also defined for Bounded_String and Unbounded_String.

Usage
A : String := 10 * 'X';

Working Example
The character replication operator is part of the Ada.Strings.Fixed package. You need to and  the package to make the operator visible.

; ;  Operator_Multiply_2 Ada.Strings.Fixed; A : String := 10 * 'X'; T_IO Ada.Text_IO; T_IO.Put_Line ("A = " & A); Operator_Multiply_2;

String replication
A String is created where a source string is replicated n-times.

"*" (Left : Natural; Right : String) String;

In addition to standard fixed strings this operator is also defined for Bounded_String and Unbounded_String.

Usage
A : String := 3 * "Hello ";

Working Example
The string replication operator is part of the package. You need to and  the package to make the operator visible.

; ;  Operator_Multiply_3 Ada.Strings.Fixed; A : String := 3 * "Hello "; T_IO Ada.Text_IO; T_IO.Put_Line ("A = " & A); Operator_Multiply_3;

Wikibook

 * Ada Programming
 * Ada Programming/Delimiters
 * Ada Programming/Operators

Ada 2005 Reference Manual


|*