Experts,
I've built a string using the StringBuilder as follows;
StringBuilder sb = new StringBuilder();
I then add items to sb as follows:
sb.AppendLine(str.ToString
());
My questions are:
1. Why is a StringBuilder used, and not - string += "Some more string";
2. How do I search in a string built using sb - My previous search are done on strings as follows:
int first = sb.IndexOf("silly");
...but the above doesnt work, because sb is a stringbuilder object, and not a string. Should I just do..
string something = sb.ToString();
int first = sb.IndexOf("silly");
( Im worried the above could cause issues with larger strings).
Start Free Trial