Repeat a string: Difference between revisions

Ada solution added
(→‎{{header|Pure}}: Pure implementation)
(Ada solution added)
Line 1:
{{task|String manipulation}}Take a string and repeat it some number of times. Example: repeat("ha", 5) => "hahahahaha"
 
=={{header|Ada}}==
In [[Ada]] multiplication of an universal integer to string gives the desired result. Here is an example of use:
<lang Ada>
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Text_IO; use Ada.Text_IO;
 
procedure String_Multiplication is
begin
Put_Line (5 * "ha");
end String_Multiplication;
</lang>
Sample output:
<pre>
hahahahaha
</pre>
=={{header|C}}==
<lang c>