How to split a string into N substrings in a slice by separator in Go

1 Answer

0 votes
package main
  
import (
    "fmt"
    "strings"
)
  
func main() {
    s := strings.SplitN("a,b,c,d,e", ",", 3)
     
    fmt.Printf("%q", s)
}
  
  
  
/*
run:
   
["a" "b" "c,d,e"]
   
*/

 



answered Aug 20, 2020 by avibootz
...