In a subtitle "Important methods in the StringBuffer and StringBuilder Classes":
under method delete() I found:
"...The starting index of the SUBSTRING to be removed is defined by the first argument (which is zero-based), and the ending index of the substring to be removed is defined by the second argument (but it is one-based)!..."
under method insert():
"...the offset is zero-based..."
Or is there any other places you saw that?
And I'm glad you asked it, cause I thought that StringBuffer/Builder is zero-based after I read the chapter (don't know why).
Jia Tan wrote:For String/StringBuilder/StringBuffer functions, can we say index parameter are all 0-based, but the first index will always be inclusive, and the second index(if present) are always exclusive?
Jia, that's exactly the way I think about it, and I think it's the most logical and easiest way to remember how it works.
All code in my posts, unless a source is explicitly mentioned, is my own.