```
func main() {
var (
str = "a=aaa,b=bbb,c=ccc"
format = "a=%s,b=%s,c=%s"
a string
b string
c string
)
if _, err := fmt.Sscanf(str, format, &a, &b, &c); err != nil {
log.Fatal(err)
}
log.Println("a:", a)
log.Println("b:", b)
log.Println("c:", c)
}
```
```
output: 2022/09/21 17:18:41 unexpected EOF
```
这是什么问题?
更多评论
// Sscanf scans the argument string, storing successive space-separated
// values into successive arguments as determined by the format. It
// returns the number of items successfully parsed.
// Newlines in the input must match newlines in the format.
#1
// Sscanf scans the argument string, storing successive space-separated
// values into successive arguments as determined by the format. It
// returns the number of items successfully parsed.
// Newlines in the input must match newlines in the format.
func Sscanf(str string, format string, a ...any) (n int, err error) {
return Fscanf((*stringReader)(&str), format, a...)
}
#2