Why StringBuilder was removed?
My question is simple. Some time ago StringBuilder was removed. What may be the reason of that? How can I deal with 开发者_如何学Golarge strings now?
flash.utils.StringBuilder
was first introduced as a response to a lack of performance in String
concatanation. But then String
concatanation was optimized so there were no reason to use/keep this Class
.
Quote from http://onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf page 38
For awhile, we had a class flash.utils.StringBuilder for fast string concatenation What happened? A: We made the + operator super-fast by implementing compound strings (cords), so StringBuilder was unneeded and removed
I don't know for StringBuilder, for if you are using Flex there's the (open source) StringUtil Class. I guess you could use the it as is by copying the source file in your project. I know downloading the whole SDK for one file can be a turn off, but I don't think I can link directly to the file.
You can also check out this related question : StringBuilder in Flex
StringBuilder class was present in early Flash Player 8.5/9 Alphas and Betas, so I don't think they even finished it.
If you are worried about Visible text, you can use TextField.appendText method, which supposed to be optimised String modification method.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#appendText()
精彩评论