StringBuilder
Frequent concatenation of strings (e.g., with + in a loop) creates multiple String objects due to immutability, which can be memory- and performance-intensive. Using StringBuilder or StringBuffer instead allows for efficient concatenation as they modify their content without creating new objects.
sb = StringBuilder new
sb appendLine: "a veeeery long string"
sb appendLine: "another veeeery long string"
result = sb toString
unary
toString -> String
first -> String
last -> String
count -> Int
keyword
Appends the string representation of the arg
append: Any -> StringBuilder
Appends the string representation of the arg
appendLine: Any -> StringBuilder
Last modified: 02 November 2024