AppendString encodes and adds a string to the dst byte array.
(dst []byte, s string)
| 20 | |
| 21 | // AppendString encodes and adds a string to the dst byte array. |
| 22 | func (Encoder) AppendString(dst []byte, s string) []byte { |
| 23 | major := majorTypeUtf8String |
| 24 | |
| 25 | l := len(s) |
| 26 | if l <= additionalMax { |
| 27 | lb := byte(l) |
| 28 | dst = append(dst, major|lb) |
| 29 | } else { |
| 30 | dst = appendCborTypePrefix(dst, majorTypeUtf8String, uint64(l)) |
| 31 | } |
| 32 | return append(dst, s...) |
| 33 | } |
| 34 | |
| 35 | // AppendStringers encodes and adds an array of Stringer values |
| 36 | // to the dst byte array. |
no test coverage detected