Method / Function What it Does Example & Result
Reverses the entire
reverse() StringBuilder [Link]() → "dlroW olleH"
sequence.
Returns the current
number of
length() [Link]() → 11
characters in
StringBuilder.
Shows the internal
capacity() buffer size (auto- [Link]() → e.g., 16 + initial length
grows if needed).
Changes the length:
trims if shorter, pads
setLength(newLen) [Link](5) → keeps only first 5 chars
with \u0000 if
longer.
Returns the
character at a
charAt(index) [Link](2) → 'l'
specific index (0-
based).
Returns a new String
substring(start) from start to the [Link](6) → "World"
end.
Returns a new String
substring(start, end) from start (inclusive) [Link](0,5) → "Hello"
to end (exclusive).
Adds text (or any
append(x) type) to the end of [Link](" World") → "Hello World"
StringBuilder.
Inserts text at a
insert(index, str) given position in [Link](5, ",") → "Hello, World"
StringBuilder.
Replaces characters
replace(start, end, str) in [start,end) with [Link](0, 5, "Hi") → "Hi, World"
new text.
Removes characters
delete(start, end) in [start,end) from [Link](3, 6)
StringBuilder.
Method / Function What it Does Example & Result
Removes the
character at a single
deleteCharAt(index) [Link](0)
index in
StringBuilder.
Sets the character at
setCharAt(index, ch) a specific index in [Link](0, 'h')
StringBuilder.
Checks if a character char ch = 'A'; if([Link](ch))
[Link](ch) is alphanumeric [Link]("alphanumeric"); →
(letter or digit). "alphanumeric"
Converts all
String s = "Hello World"; [Link]() →
[Link]() characters of a string
"HELLO WORLD"
to uppercase.
Converts all
String s = "Hello World"; [Link]() →
[Link]() characters of a string
"hello world"
to lowercase.
Converts a single
[Link](ch) character to char ch = 'a'; [Link](ch) → 'A'
uppercase.
Converts a single
[Link](ch) character to char ch = 'A'; [Link](ch) → 'a'
lowercase.