Repeat a string: Difference between revisions

Content added Content deleted
m (→‎{{header|Explore}}: The second example has a shorter description.)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 156: Line 156:


<pre>hahahahaha</pre>
<pre>hahahahaha</pre>



=={{header|ATS}}==
=={{header|ATS}}==
Line 228: Line 227:
<lang babel>hahahahaha</lang>
<lang babel>hahahahaha</lang>
The '<<' operator prints, 'dup' duplicates the top-of-stack, 'times' does something x number of times. The arrows mean down (<-) and up (->) respectively - it would require a lengthy description to explain what this means, refer to the doc/babel_ref.txt file in the github repo linked from [[Babel]]
The '<<' operator prints, 'dup' duplicates the top-of-stack, 'times' does something x number of times. The arrows mean down (<-) and up (->) respectively - it would require a lengthy description to explain what this means, refer to the doc/babel_ref.txt file in the github repo linked from [[Babel]]

=={{header|BaCon}}==
To repeat a string:
<lang qbasic>DOTIMES 5
s$ = s$ & "ha"
DONE
PRINT s$</lang>
{{out}}
<pre>
hahahahaha
</pre>
To repeat one single character:
<lang qbasic>PRINT FILL$(5, ASC("x"))</lang>
{{out}}
<pre>
xxxxx
</pre>


=={{header|Batch File}}==
=={{header|Batch File}}==
Line 266: Line 282:


:END</lang>
:END</lang>

=={{header|BaCon}}==
To repeat a string:
<lang qbasic>DOTIMES 5
s$ = s$ & "ha"
DONE
PRINT s$</lang>
{{out}}
<pre>
hahahahaha
</pre>
To repeat one single character:
<lang qbasic>PRINT FILL$(5, ASC("x"))</lang>
{{out}}
<pre>
xxxxx
</pre>


=={{header|BBC BASIC}}==
=={{header|BBC BASIC}}==
<lang bbcbasic> PRINT STRING$(5, "ha")</lang>
<lang bbcbasic> PRINT STRING$(5, "ha")</lang>



=={{header|beeswax}}==
=={{header|beeswax}}==
Line 588: Line 586:


<lang Delphi>StrUtils.DupeString</lang>
<lang Delphi>StrUtils.DupeString</lang>

=={{header|Déjà Vu}}==
<lang dejavu>!. concat( rep 5 "ha" )</lang>
{{out}}
<pre>"hahahahaha"</pre>


=={{header|DWScript}}==
=={{header|DWScript}}==
Line 609: Line 602:
=={{header|Dyalect}}==
=={{header|Dyalect}}==
<lang dyalect>String(values: Array.empty(5, '*'))</lang>
<lang dyalect>String(values: Array.empty(5, '*'))</lang>

=={{header|Déjà Vu}}==
<lang dejavu>!. concat( rep 5 "ha" )</lang>
{{out}}
<pre>"hahahahaha"</pre>


=={{header|E}}==
=={{header|E}}==
Line 646: Line 644:
end
end
</lang>
</lang>

=={{header|Elena}}==
=={{header|Elena}}==
ELENA 4.x :
ELENA 4.x :
Line 772: Line 771:
Output:
Output:
hahahahaha
hahahahaha

=={{header|Free Pascal}}==
<lang pascal>strUtils.dupeString('ha', 5)</lang>
Repetition of a single character:
<lang pascal>stringOfChar('*', 5)</lang>
If the repeated character happens to be the space character:
<lang pascal>space(5)</lang>


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
Line 810: Line 816:
*****
*****
</pre>
</pre>

=={{header|Free Pascal}}==
<lang pascal>strUtils.dupeString('ha', 5)</lang>
Repetition of a single character:
<lang pascal>stringOfChar('*', 5)</lang>
If the repeated character happens to be the space character:
<lang pascal>space(5)</lang>


=={{header|Frink}}==
=={{header|Frink}}==
Line 1,581: Line 1,580:
=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>"ha" x 5</lang>
<lang perl>"ha" x 5</lang>

=={{header|Perl 6}}==
<lang perl6>print "ha" x 5</lang>
(Note that the <code>x</code> operator isn't quite the same as in Perl 5: it now only creates strings. To create lists, use <code>xx</code>.)


=={{header|Phix}}==
=={{header|Phix}}==
Line 1,736: Line 1,731:
(make-string 5 #\*) => "*****"
(make-string 5 #\*) => "*****"
</lang>
</lang>

=={{header|Raku}}==
(formerly Perl 6)
<lang perl6>print "ha" x 5</lang>
(Note that the <code>x</code> operator isn't quite the same as in Perl 5: it now only creates strings. To create lists, use <code>xx</code>.)


=={{header|RapidQ}}==
=={{header|RapidQ}}==
Line 1,905: Line 1,905:
=={{header|Ring}}==
=={{header|Ring}}==
<lang ring> Copy("ha" , 5) # ==> "hahahahaha"</lang>
<lang ring> Copy("ha" , 5) # ==> "hahahahaha"</lang>



=={{header|Ruby}}==
=={{header|Ruby}}==
Line 1,949: Line 1,948:
hahahahaha
hahahahaha
</lang>
</lang>

=={{header|Seed7}}==
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
<lang seed7>$ include "seed7_05.s7i";
Line 2,156: Line 2,156:
=={{header|Tcl}}==
=={{header|Tcl}}==
<lang tcl>string repeat "ha" 5 ;# => hahahahaha</lang>
<lang tcl>string repeat "ha" 5 ;# => hahahahaha</lang>

=={{header|TorqueScript}}==
--[[User:Eepos|Eepos]]
<lang TorqueScript>function strRep(%str,%int)
{
for(%i = 0; %i < %int; %i++)
{
%rstr = %rstr@%str;
}

return %rstr;
}</lang>


=={{header|Tosh}}==
=={{header|Tosh}}==
Line 2,166: Line 2,178:
end
end
stop this script</lang>
stop this script</lang>

=={{header|Transact-SQL}}==
<lang tsql>select REPLICATE( 'ha', 5 )</lang>


=={{header|TUSCRIPT}}==
=={{header|TUSCRIPT}}==
Line 2,172: Line 2,187:
repeatstring=REPEAT ("ha",5)
repeatstring=REPEAT ("ha",5)
</lang>
</lang>

=={{header|TorqueScript}}==
--[[User:Eepos|Eepos]]
<lang TorqueScript>function strRep(%str,%int)
{
for(%i = 0; %i < %int; %i++)
{
%rstr = %rstr@%str;
}

return %rstr;
}</lang>
=={{header|Transact-SQL}}==
<lang tsql>select REPLICATE( 'ha', 5 )</lang>


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==