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

Related questions

2 answers 237 views
1 answer 143 views
3 answers 304 views
304 views asked May 25, 2020 by avibootz
...