This method returns the reversed object on which it was called. The delete method deletes a sequence of characters from the invoking object.
Here, the start Index specifies the index of the first character to remove, and the end Index specifies an index one past the last character to remove. Thus, the substring deleted runs from start Index to endIndex—1. The resulting StringBuffer object is returned. The deleteCharAt method deletes the character at the index specified by loc. It returns the resulting StringBuffer object. The substring being replaced is specified by the indexes start Index and endIndex. Thus, the substring at start Index through endIndex—1 is replaced.
The replacement string is passed in str. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Skip to content. Change Language. Related Articles. Basics of Java. Operators in Java. Packages in Java. Flow Control in Java. Loops in Java. Jump Statements in Java.
Attempts to reduce storage used for the character sequence. If the buffer is larger than necessary to hold its current sequence of characters, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value returned by a subsequent call to the capacity method. Sets the length of the character sequence.
The sequence is changed to a new character sequence whose length is specified by the argument. In other words, if the newLength argument is less than the current length, the length is changed to the specified length. The newLength argument must be greater than or equal to 0. Returns the char value in this sequence at the specified index.
The first char value is at index 0 , the next at index 1 , and so on, as in array indexing. Returns the character Unicode code point at the specified index. The index refers to char values Unicode code units and ranges from 0 to CharSequence. Returns the character Unicode code point before the specified index. The index refers to char values Unicode code units and ranges from 1 to CharSequence. The text range begins at the specified beginIndex and extends to the char at index endIndex - 1.
Thus the length in char s of the text range is endIndex-beginIndex. Unpaired surrogates within this sequence count as one code point each. Unpaired surrogates within the text range given by index and codePointOffset count as one code point each.
The first character to be copied is at index srcBegin ; the last character to be copied is at index srcEnd The total number of characters to be copied is srcEnd-srcBegin.
The character at the specified index is set to ch. This sequence is altered to represent a new character sequence that is identical to the old character sequence, except that it contains the character ch at position index. Appends the string representation of the Object argument. Appends the specified string to this character sequence. Appends the specified StringBuffer to this sequence. Appends the specified CharSequence to this sequence. Removes the characters in a substring of this sequence.
The substring begins at the specified start and extends to the character at index end - 1 or to the end of the sequence if no such character exists. If start is equal to end , no changes are made. Removes the char at the specified position in this sequence. This sequence is shortened by one char.
First the characters in the substring are removed and then the specified String is inserted at start. This sequence will be lengthened to accommodate the specified String if necessary. The substring begins at the specified index and extends to the end of this sequence.
Returns a new character sequence that is a subsequence of this sequence. The substring begins at the specified start and extends to the character at index end - 1. The subarray begins at the specified offset and extends len char s. The characters of the subarray are inserted into this sequence at the position indicated by index. The length of this sequence increases by len char s. Inserts the string into this character sequence.
Inserts the specified CharSequence into this sequence. The start argument must be nonnegative, and not greater than end. The last occurrence of the empty string "" is considered to occur at the index value this. Causes this character sequence to be replaced by the reverse of the sequence.
If there are any surrogate pairs included in the sequence, these are treated as single characters for the reverse operation. This method returns the index within this string of the first occurrence of the specified substring, starting at the specified index. This method inserts the string representation of a subarray of the str array argument into this sequence. This method inserts the string representation of the Object argument into this character sequence. This method returns the index within this string of the rightmost occurrence of the specified substring.
This method returns the index within this string of the last occurrence of the specified substring. This method returns the index within this sequence that is offset from the given index by codePointOffset code points. This method replaces the characters in a substring of this sequence with characters in the specified String. This method returns a new String that contains a subsequence of characters currently contained in this character sequence. This method returns a new String that contains a subsequence of characters currently contained in this sequence.
StringBuffer Class Advertisements. Previous Page. Next Page. Previous Page Print Page. Save Close. Sign Out Sign In Register. Latest Insider. Check out the latest Insider stories here. More from the IDG Network. String java. String valueOf java. StringBuffer java. StringBuffer append java. Related: Build Automation.
0コメント