Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Created April 27, 2010 22:40
Show Gist options
  • Save jasonm23/381441 to your computer and use it in GitHub Desktop.
Save jasonm23/381441 to your computer and use it in GitHub Desktop.
AS3/Flex StringUtil.substitute
StringUtil.substitute("ClassName [name={0}, key={1}, field={2}, etc={3}]", name, key, field, etc);
/*
StringUtil.substitute is a useful print formatter tucked away in the Flex SDK, if you're used to printf in C or String.format() in C# you'll be glad to find this
Whatever the case, rolling a complex string in AS3 is much easier with this than the alternative.
e.g.
"ClassName [name=" + name + ", key=" + key + ", field=" + field + ", etc=" + etc + "]";
Which is pretty horrible, but I'm sure you've had to build 100's or 1000's of strings like this.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment