Module jls.lang.StringBuffer
Represents a mutable string.
Class StringBuffer
StringBuffer:new ([...]) | Creates a new StringBuffer. |
stringBuffer:append (value, ...) | Appends the string representation of the value to this buffer. |
stringBuffer:sub (i[, j]) | Returns a part of this string buffer. |
stringBuffer:delete (i[, j]) | Removes a part of this string buffer. |
stringBuffer:insert (i, s) | Inserts a string to this string buffer at the specified position. |
stringBuffer:replace (i, j, s) | Replaces a part of this string buffer by the specified string. |
stringBuffer:clear () | Clears this string buffer. |
stringBuffer:setLength (i) | Sets the length of this string buffer. |
stringBuffer:length () | Returns the length of this buffer. |
stringBuffer:toString () | Returns the string representation of this buffer. |
Class StringBuffer
A StringBuffer class.
The StringBuffer optimizes the addition of strings in a buffer by avoiding the use of intermediary concatenated string.
- StringBuffer:new ([...])
-
Creates a new StringBuffer.
Parameters:
- ... string The initial values. (optional)
- stringBuffer:append (value, ...)
-
Appends the string representation of the value to this buffer.
Parameters:
- value the value to append.
- ... more values to append.
Returns:
-
StringBuffer
this buffer.
- stringBuffer:sub (i[, j])
-
Returns a part of this string buffer.
Parameters:
- i number the index of the first byte to remove.
- j number the index of the last byte to remove. (optional)
Returns:
-
StringBuffer
the buffer containing the sub string.
- stringBuffer:delete (i[, j])
-
Removes a part of this string buffer.
Parameters:
- i number the index of the first byte to remove.
- j number the index of the last byte to remove. (optional)
Returns:
-
StringBuffer
this buffer.
- stringBuffer:insert (i, s)
-
Inserts a string to this string buffer at the specified position.
Parameters:
- i number the index of the byte where the string will be inserted.
- s string the string to insert.
Returns:
-
StringBuffer
this buffer.
- stringBuffer:replace (i, j, s)
-
Replaces a part of this string buffer by the specified string.
Parameters:
- i number the index of the byte where the string will be inserted.
- j number the index of the last byte to replace.
- s string the string to use as replacement.
Returns:
-
StringBuffer
this buffer.
- stringBuffer:clear ()
-
Clears this string buffer.
Returns:
-
StringBuffer
this buffer.
- stringBuffer:setLength (i)
-
Sets the length of this string buffer.
Padding will be done with zeros '\0'.
Parameters:
- i number the new length.
Returns:
-
StringBuffer
this buffer.
- stringBuffer:length ()
-
Returns the length of this buffer.
Returns:
-
number
the length of this buffer.
- stringBuffer:toString ()
-
Returns the string representation of this buffer.
Returns:
-
string
the string representation of this buffer.