Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Non loop way of creating a string of a certain length
/**
* 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
You can’t perform that action at this time.