Created
April 27, 2010 22:40
-
-
Save jasonm23/381441 to your computer and use it in GitHub Desktop.
AS3/Flex StringUtil.substitute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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