How to remove the first and the last character from a string in Go

1 Answer

0 votes
package main

import (
	"fmt"
)

func main() {
	s := "go programming"
	
	s = s[1 : len(s)-1]
	
	fmt.Println(s)
}


/*
run:

o programmin

*/

 



answered Sep 7, 2024 by avibootz

Related questions

1 answer 126 views
1 answer 108 views
1 answer 101 views
1 answer 164 views
1 answer 128 views
...