Limiting String size


#1

What is the easiest method to limit the size of a string, so that when the string expands past a certain size after lots of concatenations . . .

s = s + Sting(“some more stringy goodness”);

. . the beginning of the string is deleted.

The reason I ask is that I have made a log viewer that updates itself as the string Value in a ValueTree has more information added. I want to limit the size of the log to show relatively recent information only. Can anyone think of an easy solution to save wheel reinvention?


#2

String is a very bad class to use like that - performance will be awful. Much better to store a StringArray containing the lines, and drop the initial elements when it gets too large.


#3

Cool gotcha. Then use Value::setValue ( StringArray::joinIntoString(… yadda yadda