Skip to content
Reference > Classes

StringBuilder

Definition

StringBuilder var = .... ;

Extends

Extended By

None

Description

A mutable sequence of characters

Method Summary

Owner Name Return Type Description
StringBuilder constructor() StringBuilder Initialize a StringBuilder object
StringBuilder constructor(s) StringBuilder Initialize a StringBuilder object with the same characters as the string provided
StringBuilder constructor(capacity) StringBuilder Initialize a StringBuilder object with an initial capacity
StringBuilder append(value) StringBuilder Appends the object to the StringBuilder
StringBuilder clear() StringBuilder Clears the StringBuilder
StringBuilder delete(start, end) StringBuilder Deletes the characters in the range from the StringBuidler
StringBuilder deleteCharAt(offset) StringBuilder Delete the char at the offset in the Stringbuilder
StringBuilder ensureCapacity(capacity) StringBuilder Ensures the capacity of the Stringbuilder
StringBuilder getCapacity() Integer Get the capcity of the StringBuilder
StringBuilder getCharAt(offset) Character Returns the char at the offset in the Stringbuilder
Object getClassName() String Returns the string name of this object's class type.
StringBuilder insert(offset, value) StringBuilder Inserts the object to the StringBuilder at an offset
StringBuilder length() Integer Get the length of the StringBuilder
StringBuilder reverse() StringBuilder Reverses the character sequence in the StringBuilder
StringBuilder setCharAt(offset, char) StringBuilder Set the char at the offset in the Stringbuilder
StringBuilder splice(start, end, value) StringBuilder Splice and replace the characters in the range from the StringBuidler with the value
StringBuilder substring(start, end) String Returns the substring within the range of StringBuilder
Object toJson() String Returns a json representation of this object.
StringBuilder toString() String Evaluates StringBuilder to a String
StringBuilder toStringAndClear() String Evaluates StringBuilder to a String and clears it
StringBuilder trimCapacity() StringBuilder Tries to trim the StringBuilder to its size

Method Definitions


constructor()

StringBuilder stringbuilder = new StringBuilder()

Description

Initialize a StringBuilder object


constructor(s)

StringBuilder stringbuilder = new StringBuilder(Object s)

Description

Initialize a StringBuilder object with the same characters as the string provided

Parameter Definition

Name Type Description
s Object  a String

constructor(capacity)

StringBuilder stringbuilder = new StringBuilder(Integer capacity)

Description

Initialize a StringBuilder object with an initial capacity

Parameter Definition

Name Type Description
capacity Integer  int capacity

append(value)

StringBuilder StringBuilder::append(Object value)

Description

Appends the object to the StringBuilder

Parameter Definition

Name Type Description
value Object  value to append

clear()

StringBuilder StringBuilder::clear()

Description

Clears the StringBuilder


delete(start,end)

StringBuilder StringBuilder::delete(Integer start, Integer end)

Description

Deletes the characters in the range from the StringBuidler

Parameter Definition

Name Type Description
start Integer  start position inclusive
end Integer  end positon exclusive

deleteCharAt(offset)

StringBuilder StringBuilder::deleteCharAt(Integer offset)

Description

Delete the char at the offset in the Stringbuilder

Parameter Definition

Name Type Description
offset Integer 

ensureCapacity(capacity)

StringBuilder StringBuilder::ensureCapacity(Integer capacity)

Description

Ensures the capacity of the Stringbuilder

Parameter Definition

Name Type Description
capacity Integer 

getCapacity()

Integer StringBuilder::getCapacity()

Description

Get the capcity of the StringBuilder


getCharAt(offset)

Character StringBuilder::getCharAt(Integer offset)

Description

Returns the char at the offset in the Stringbuilder

Parameter Definition

Name Type Description
offset Integer 

insert(offset,value)

StringBuilder StringBuilder::insert(Integer offset, Object value)

Description

Inserts the object to the StringBuilder at an offset

Parameter Definition

Name Type Description
offset Integer  offset to insert at
value Object  value to append

length()

Integer StringBuilder::length()

Description

Get the length of the StringBuilder


reverse()

StringBuilder StringBuilder::reverse()

Description

Reverses the character sequence in the StringBuilder


setCharAt(offset,char)

StringBuilder StringBuilder::setCharAt(Integer offset, Character char)

Description

Set the char at the offset in the Stringbuilder

Parameter Definition

Name Type Description
offset Integer 
char Character  character

splice(start,end,value)

StringBuilder StringBuilder::splice(Integer start, Integer end, Object value)

Description

Splice and replace the characters in the range from the StringBuidler with the value

Parameter Definition

Name Type Description
start Integer  start position inclusive
end Integer  end positon exclusive
value Object  value to replace with

substring(start,end)

String StringBuilder::substring(Integer start, Integer end)

Description

Returns the substring within the range of StringBuilder

Parameter Definition

Name Type Description
start Integer  start position inclusive
end Integer  end positon exclusive

toString()

String StringBuilder::toString()

Description

Evaluates StringBuilder to a String


toStringAndClear()

String StringBuilder::toStringAndClear()

Description

Evaluates StringBuilder to a String and clears it


trimCapacity()

StringBuilder StringBuilder::trimCapacity()

Description

Tries to trim the StringBuilder to its size