You can get a range of characters within a string in Golang using [:]
. It takes the start and end index and return the substring. To remove last character, you can use [:length of str -1]
.
Code Example
str := "Ironman_" str = str[:len(str) - 1]
You can get a range of characters within a string in Golang using [:]
. It takes the start and end index and return the substring. To remove last character, you can use [:length of str -1]
.
str := "Ironman_" str = str[:len(str) - 1]