Index
- [[#stringbuilder|
StringBuilder
]]- [[#append|
append()
]]- [[#insert|
insert()
]]
StringBuilder
Package: java.lang
Description:
StringBuilder
is a mutable sequence of characters. It is part of the java.lang
package. It is like String
, but can be modified. It is efficient for concatenating multiple strings together.
it can be used toughener with:
- [[#append|
append()
]] - [[#insert|
insert()
]]
append()
Description:
The append()
method appends the string representation of the given argument to the sequence.
Syntax:
Parameters:
The append()
method takes one parameter:
s
(required): This is theString
that is appended to the end of thisStringBuilder
.
Return Value:
This method returns a reference to this object to enable chaining of calls to methods.
Example:
insert()
Description:
The insert()
method inserts the string representation of the second argument into the sequence at the specified position.
Syntax:
Parameters:
The insert()
method takes two parameters:
index
(required): This is the position at which to insert the second argument.s
(required): This is theString
that is inserted.
Return Value:
This method returns a reference to this object to enable chaining of calls to methods.
Example: