Answers for "regex to split string into num and char golang"

0

regex to split string into num and char golang

package main
 
import (
    "fmt"
    //"strings"
    "regexp"
)
 
func main() {       
    s := "xyzxyzxyzxyzxyz"
     
    t := regexp.MustCompile(`[y]`)  // backticks are used here to contain the expression
     
    v := t.Split(s, -1)             // second arg -1 means no limits for the number of substrings
    fmt.Println(v)     // [x zx zx zx zx z]
}
Posted by: Guest on April-09-2021

Code answers related to "regex to split string into num and char golang"

Browse Popular Code Answers by Language