How to trim whitespace from string in Golang

  • 25 September 2019
  • ADM

How to trim (remove) leading and trailing whitespace from string in Golang using the TrimSpace, Trim, TrimLeft, TrimRight methods from strings package.


How to get the dimensions of an image in Golang

  • 20 June 2019
  • ADM

Here are two simple methods to get the dimensions of an image in Golang: using image.DecodeConfig method if the image is not already loaded and image.Decode method is the image is loaded.


How to split a string into slice in Golang

  • 15 May 2019
  • ADM

How to split a string into slice using Golang. For a simple split by a singular character you can use Split() method from strings package. For more complex rules the regexp.Split() method can be used.


How to convert string to uppercase in Golang

  • 08 May 2019
  • ADM

How to convert a string into uppercase in Golang using ToUpper method from strings package.


How to convert string to lowercase in Golang

  • 07 May 2019
  • ADM

How to convert a string into lowercase in Golang using ToLower method from strings package.


How to convert string to hex string in Golang

  • 26 June 2020
  • ADM

How to convert a string into a hex string in Golang using EncodeToString method from encoding/hex package.