Created
March 9, 2012 17:01
-
-
Save darylducharme/2007522 to your computer and use it in GitHub Desktop.
Non loop way of creating a string of a certain length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a string by repeating a string a certain number of times | |
* @param str The String to repeat | |
* @param count The number of times to repeat the string | |
*/ | |
function repeatString(str:String, count:uint):String { | |
var output:Vector.<uint> = new Vector.<uint>(count, true); | |
return output.join("").replace(/0/g, str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment