Skip to content

Instantly share code, notes, and snippets.

@0x04
Last active February 25, 2020 13:00
Show Gist options
  • Save 0x04/ae41d3fb3a7cf9a1136ec2130d553d60 to your computer and use it in GitHub Desktop.
Save 0x04/ae41d3fb3a7cf9a1136ec2130d553d60 to your computer and use it in GitHub Desktop.
package com.utils
{
public class StringUtil {
static public function padStart(string:String, length:uint, padString:String = ' '):String {
var insert:String = '';
for (var i:int = 0; i < length; i++) {
insert += padString;
}
return insert + string;
}
}
}
@0x04
Copy link
Author

0x04 commented Feb 25, 2020

trace(StringUtil.padStart('Hello world!', 5, '.'));
// > ".....Hello World!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment