Repeat a string: Difference between revisions

GP
(Added another Delphi example)
(GP)
Line 548:
in
{System.showInfo {Repeat "Ha" 5}}</lang>
 
=={{header|PARI/GP}}==
This solution is unimaginably bad. Slightly less bad versions can be designed, but that's not the point: don't use GP for text processing if you can avoid it. If you really need to, it's easy to create an efficient function in PARI (see [[#C|C]]) and pass that to GP.
<lang parigp>repeat(s,n)={
if(n, Str(repeat(s, n-1), s), "")
};</lang>
 
=={{header|Perl}}==
Line 788 ⟶ 794:
=={{header|Yorick}}==
<lang yorick>array("ha", 5)(sum)</lang>
 
{{omit from|PARI/GP|No real capacity for string manipulation}}
 
[[Category: String manipulation]]