This content has been marked as final. Show 2 replies
i heard that using subString method is String andWhere did you hear that? All it does (in sun's implementation) is create a new string object that references the same underlying char array as the original string with a different offset and count. This is done specifically for performance.
StringBuffer are slow
would iterating the range and appending it to aNo
StringBuffer character by character would be faster?
EDIT: Just to add that because the char array of the original string is used this can cause memory issues if you hold onto the substring references (the original strings char array cannot be gc'ed until the substring's references can also be gc'ed since both strings refer to the same array)