decStringSequence receives a byte slice with strings separated by spaces and a preallocated destination slice. It reads strings from the source byte slice and stores in the destination array.
(cdata []byte, dest []string)
| 380 | // It reads strings from the source byte slice and |
| 381 | // stores in the destination array. |
| 382 | func decStringSequence(cdata []byte, dest []string) error { |
| 383 | |
| 384 | var br bytesReader |
| 385 | br.Init(cdata) |
| 386 | idx := 0 |
| 387 | for { |
| 388 | tok := br.TokenNext() |
| 389 | if tok == nil { |
| 390 | break |
| 391 | } |
| 392 | if idx >= len(dest) { |
| 393 | return fmt.Errorf("To many string array data") |
| 394 | } |
| 395 | dest[idx] = string(tok) |
| 396 | idx++ |
| 397 | } |
| 398 | if idx < len(dest)-1 { |
| 399 | return fmt.Errorf("Expected %d strings, got %d", len(dest), idx) |
| 400 | } |
| 401 | return nil |
| 402 | } |
| 403 | |
| 404 | func f32sToString(a []float32, max int) string { |
| 405 |
no test coverage detected