Repeat a string: Difference between revisions

Content added Content deleted
(Added another Delphi example)
(GP)
Line 548: Line 548:
in
in
{System.showInfo {Repeat "Ha" 5}}</lang>
{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}}==
=={{header|Perl}}==
Line 788: Line 794:
=={{header|Yorick}}==
=={{header|Yorick}}==
<lang yorick>array("ha", 5)(sum)</lang>
<lang yorick>array("ha", 5)(sum)</lang>

{{omit from|PARI/GP|No real capacity for string manipulation}}


[[Category: String manipulation]]
[[Category: String manipulation]]