Closed
Description
Typical functionality of a builder function consists of chaining operation. The exisitng implementation of Append
function can be modified to return *StringBuilder
. This will facilitate chaining operation and end up resulting in cleaner code.
For example current sample code is as below:
sb := Text.StringBuilder{}
sb.Append("Hello")
sb.Append(" ")
sb.Append("World")
fmt.Println(sb.ToString())
With the updated feature, above code will look like:
sb := Text.StringBuilder{}
s := sb.Append("Hello").Append(" ").Append("World").ToString()
fmt.Println(s)
I will be happy to add a POC implementation for this feature and can extend the implementation to other Append
functions in future.
Let me know what you think @linkdotnet
Metadata
Metadata
Assignees
Labels
No labels