How to remove all spaces from a string in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"strings"
)

func main() {
	s := "golang    c# rust java c    c++ python"

	s = strings.ReplaceAll(s, " ", "")

	fmt.Println(s)
}


/*
run:

golangc#rustjavacc++python

*/

 



answered Oct 14, 2024 by avibootz
...