Repeat a string: Difference between revisions
Content added Content deleted
m (→{{header|Tailspin}}: syntax update) |
(Add Processing) |
||
Line 1,615:
=={{header|PowerShell}}==
<lang powershell>"ha" * 5 # ==> "hahahahaha"</lang>
=={{header|Processing}}==
<lang processing>void setup() {
String rep = repeat("ha", 5);
println(rep);
}
String repeat(String str, int times) {
// make an array of n chars,
// replace each char with str,
// and return as a new String
return new String(new char[times]).replace("\0", str);
}</lang>
=={{header|Prolog}}==
|