Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created July 23, 2011 05:37
Show Gist options
  • Save rafaelrinaldi/1101070 to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/1101070 to your computer and use it in GitHub Desktop.
Repeat a String how many times you want.
/**
*
* @param p_string String to be repeated.
* @param p_times How many times the string will be repeated.
*
* @return A new instance with the string repeated.
*
* @author Rafael Rinaldi (rafaelrinaldi.com)
* @since 25/03/2011
*
* */
function repeat( p_string : String, p_times : Number ) : String
{
return new Array(p_times + 1).join(p_string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment