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 132 views
1 answer 114 views
1 answer 114 views
1 answer 177 views
1 answer 137 views
...