Skip to content

linkdotnet/golang-stringbuilder

Repository files navigation

Go Go Report card GoDoc

golang-stringbuilder

A string builder that has similar capabilities as the one from C#. The goal is to have a straightforward API that lets you work with strings easily.

Install

To install the package, call:

go get -u github.com/linkdotnet/golang-stringbuilder

Next import the package:

import ( "github.com/linkdotnet/golang-stringbuilder" )

Quickstart

The API derives from the C# StringBuilder. You can easily append strings or single runes.

func main() {
	sb := Text.StringBuilder{}
	sb.Append("Hello")
	sb.Append(" ")
	sb.Append("World")
	fmt.Println(sb.ToString())
}

Also more advanced use cases where you want to insert an arbitrary word at an arbitrary position are possible.

sb := NewStringBuilderFromString("Hello World")
sb.Insert(5, " my dear")
output := sb.ToString() // Hello my dear World

About

A string builder that has similar capabilities as the one from C#.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages