Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Pascal

Idiom #266 Repeated string

Assign to the string s the value of the string v repeated n times, and write it out.

E.g. v="abc", n=5 ⇒ s="abcabcabcabcabc"

StrUtils
s := DupeString(v, n);
writeln(s);
s:= '';
for i := 1 to n do s := s + v;
writeln(s);
with Ada.Strings.Fixed;
use Ada.Strings.Fixed;
S : constant String := N * V;

New implementation...
< >
tkoenig