Answers for "golang cut part of string"

Go
1

golang substring

s = s[:len(s)-1]
Posted by: Guest on December-11-2020
2

golang slice string

First of all, you should really read about strings, bytes and runes in Go.

And here is how you can achieve what you want: Go playground (I was not able to properly paste arabic symbols, but if Chinese works, arabic should work too).

    s := "abcdefghijklmnop" 
    fmt.Println(s[2:9]) 

    s = "something which is display"
    fmt.Println(string([]rune(s)[2:9]))
Posted by: Guest on March-23-2021

Code answers related to "golang cut part of string"

Browse Popular Code Answers by Language