David Jason wrote:I have about 10,000+ strings. There are also many replace and concatenation operations on each string.
I want my code to use minimum memory. StringBuilder, does not have a convenient method like replace of String Class.
I think Vishal covered most of it, but my first question would be:
Why does your code need to use minimum memory?
And it's true that StringBuilder doesn't have a
replace(String, String) method (which I'm assuming is the one you want), but it does have
indexOf(String, fromIndex) and
replace(start, end, String) methods, which should be more than enough for you to roll your own "Stringlike replace() method"; although you might sacrifice some speed compared to String's.
I see that there is a Ropes class. I don't know if that is good.
http://ahmadsoft.org/ropes/
I may be putting the poor chap down, but I'm not sure how far I'd trust a class from a site called 'ahmadsoft.org' without a LOT of
testing.
Winston