Repeat a string: Difference between revisions
Content added Content deleted
(→{{header|ActionScript}}: added mx.utils.StringUtil.repeat()) |
|||
Line 20: | Line 20: | ||
=={{header|ActionScript}}== |
=={{header|ActionScript}}== |
||
ActionScript does not have a built-in way to repeat a string multiple times, but the addition operator can be used to concatenate strings. |
ActionScript does not have a built-in way to repeat a string multiple times, but the addition operator can be used to concatenate strings. |
||
In Flex, there is the method [http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/utils/StringUtil.html#repeat%28%29 mx.utils.StringUtil.repeat()]. |
|||
===Iterative version=== |
===Iterative version=== |
||
<lang ActionScript>function repeatString(string:String, numTimes:uint):String |
<lang ActionScript>function repeatString(string:String, numTimes:uint):String |
||
Line 37: | Line 39: | ||
return tmp + tmp; |
return tmp + tmp; |
||
}</lang> |
}</lang> |
||
===Flex=== |
|||
<lang ActionScript>import mx.utils.StringUtil; |
|||
var repeatedString:String = StringUtil.repeat(string, numTimes); |
|||
</lang> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |