印象中应该是[start, end)吧,前一个参数是包含,后一个不是。

解决方案 »

  1.   

    我没有记错,以下是API文档对这个方法的说明:deletepublic StringBuffer delete(int start, int end)Removes the characters in a substring of this StringBuffer. The substring begins at the specified start and extends to the character at index end - 1 or to the end of the StringBuffer if no such character exists. If start is equal to end, no changes are made. Parameters:
    start - The beginning index, inclusive.
    end - The ending index, exclusive. Returns:
    This string buffer. Throws: 
    StringIndexOutOfBoundsException - if start is negative, greater than length(), or greater than end.Since: 
    1.2