[49] Results

Golang : Check if item is in slice/array

golang duplicate item-in-slice array

Problem :

You need to see if an item is inside a slice or array.

Solution :

Golang does not….... 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 : How to get capacity of a slice or array?

golang cap slice array capacity len

Problem :

You have a slice and you need to find out the capacity of the slice.

Solution :

Use….... read more


Golang : Selection sort example

golang selection sort random-slice

The selection sort algorithm is an in-place comparison sort. What it does is that it loops a given slice and….... 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 : Randomize letters from a string example

golang slice scanner randomize-letters shuffle

For this short tutorial, we will learn how to randomize the letters(including symbols and empty spaces) in a string. Such….... read more


Golang : Randomly pick an item from a slice/array example

golang randomly-select shuffle-slice rand-intn

Problem:

You are building a game and you want to randomly pick an item from a slice of URLs. How….... read more


Golang : Sort and reverse sort a slice of bytes

golang sort reverse-sort slice bytes

Problem :

How to sort and reverse sort a slice of bytes ?

Solution :

Import "github.com/cznic/sortutil"

Use the ByteSlice….... read more


Advertisement