java 中 StringBuffer delete 的工作原理
How StringBuffer delete works in java
在java中,StringBuffer函数会这样工作
str="hello"
好像是指定了str.delete(1,3)
。
我想知道它是如何工作的,比如它是如何占据位置的
class StringBufferExample4 {
public static void main(String args[]) {
StringBuffer sb=new StringBuffer("Hello");
sb.delete(1,3);
System.out.println(sb);
}
}
它给出了输出
Hlo
如何?
StringBuffer delete() method 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.
来自:http://www.tutorialspoint.com/java/stringbuffer_delete.htm
在java中,StringBuffer函数会这样工作
str="hello"
好像是指定了str.delete(1,3)
。
我想知道它是如何工作的,比如它是如何占据位置的
class StringBufferExample4 {
public static void main(String args[]) {
StringBuffer sb=new StringBuffer("Hello");
sb.delete(1,3);
System.out.println(sb);
}
}
它给出了输出
Hlo
如何?
StringBuffer delete() method 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.
来自:http://www.tutorialspoint.com/java/stringbuffer_delete.htm