Skip to content

Instantly share code, notes, and snippets.

@darylducharme
Created March 9, 2012 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darylducharme/2007522 to your computer and use it in GitHub Desktop.
Save darylducharme/2007522 to your computer and use it in GitHub Desktop.
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