Tag: seq equals tar so enc. com Val pac pairs
capacity ()
-
-
returns the current capacity. Capacity refers to the amount of storage that can be used for the most recent insertion character, which needs to be reassigned.
-
-
-
-
-
Return:
-
-
current capacity.
-
public
-
int
length()
-
-
-
returns the length (number of characters).
-
-
-
Designated by:
-
CharSequence
in the interface
length
.
-
-
-
Return:
-
The length of the
-
current character sequence represented by this object.
-
The
-
capacity is the theoretical value, the length is the actual value.
-
-
Append
Appends the string representation of any type parameter to the sequence.
String.valueOf
method is the same. The characters in the resulting string are then appended to this sequence.
Reverse
Reverse ()
-
This sequence of characters is replaced with its inverse form. If there is a surrogate pair (surrogate pair) in the sequence, it is treated as a single character in the reverse operation. Therefore, the order of the high-low surrogate is not reversed. Assuming that
N is the character
reverse
length (not the length of the value) of the character sequence before the method is executed
char
, the character at index
K in the new character sequence will be equal to the word at the original character sequence index
n-k-1 Character.
Note that after the reverse operation, low and high surrogate entries that are not paired before the action is performed will become surrogate pairs. For example, reversing "\udc00\ud800" will generate a valid surrogate pair "\UD800\UDC00".
-
-
-
Return:
-
a reference to this object.
-
Here is someone who might ask what is a surrogate pair? A detailed explanation is given below.
-
the literal meaning is: the proxy pair. In effect, a UTF16 encoding is replaced by a two UTF16 encoding instead.
The estimation of translation can be: UTF16 encoding agent pair.
Why do I need surrogate pairs? The original character is represented by a UTF16 encoding (two bytes), but because of the increasing number of characters that need to be encoded, only one UTF16 encoding is not enough to represent all characters. Therefore, it is necessary to consider using 2 UTF16 to represent one character (four bytes). But if all the characters are encoded this way, too much space (originally only need 2 bytes, now instead of 4 bytes), so that only use two a certain range of UTF16 encoding is considered a set of surrogate pairs, which is used to represent a character, For the rest of the situation, a UTF16 is used to represent a character.
The detailed annotation of StringBuilder