2016-04-30 4 views

Antwort

2

Nichts in der Standard-Bibliothek, aber Google hat ihre eigene shlex Bibliothek veröffentlichen, die gegabelt ist und geändert einige in flynn-archive/go-shlex.

Zum Beispiel:

package main 

import (
    "fmt" 
    "github.com/google/shlex" 
) 

func main() { 
    input := "abc ab\\ c \"ab\\\"cd\" key=\"\\\"val\\\"\"" 
    fmt.Println("Processing:", input) 
    tokens, _ := shlex.Split(input) 
    fmt.Printf("%#v\n", tokens) 
    // []string{"abc", "ab c", "ab\"cd", "key=\"val\""} 
}