Cbab 2 sided printer6/30/2023 In this particular example, there is absolutely no reason why concatenation will become slower than StringBuilder when there are more strings in the file, since the concatenation is done separately for each row. ![]() No, the best option is NOT always to use StringBuilder! if concatenation is faster now, i am sure it will become slower when there are more strings in the file. You cant tell me string concatenation is best in that scenario, the problem has been solved already, and the choice of wether string concatenation or stringBuilder is faster should be left alone. What tommy has done is to give us only piece of the ice bergs, i am very sure that the string he is trying to read is very large and its like a story line, where he needs to delimit each word by delimeters, and re-arrange this words according to their alphabetic order, also printing their number of occurence on the right side of each word. Mattew, as part of Good practice, string concatenation is very bad because of the immutability nature of string class.
0 Comments
Leave a Reply. |