[43] Results

Golang : Clearing slice

golang slice

Slice is something that I use frequently in Go and I always prefer slice to array at anytime. If you are new to Go and….... read more

Golang : Simple histogram example

golang histogram slice iteration

This is a simple histogram program written in Golang. Can be useful in situations where you want to roughly assess….... read more

Golang : Warp text string by number of characters or runes example

golang line-break character-wrap rune-slice slice-character


You have a long text string and you want to wrap the text according to a given number of….... read more

Golang : Sort and reverse sort a slice of integers

golang sort reverse-sort slice

Problem :

How to sort and reverse sort a slice of integers ?

Solution :

Use sort.Ints and sort.Sort functions.….... read more

Golang : Convert []string to []byte examples

golang string-slice byte-slice convert

Problem :

You need a fast way to convert a []string to []byte type. To use in situations such as….... read more

Golang : Delete duplicate items from a slice/array

golang duplicate slice array

Problem :

Fairly common question or task that a programmer will face from time to time. How to remove duplicate….... read more

Golang : Convert string slice to struct and access with reflect example

golang reflect slice-to-struct

Writing this down here for my own future references. Basically, what this code does is to convert a given string….... read more

Golang : How to count duplicate items in slice/array?

golang count-duplicate slice array

Problem :

You need to count the number of duplicate items in a slice or array.

Solution :

Pseudo-code :….... read more