String encodes and writes a string value into the element bitstream. Internally, strings are deduplicated by adding them to the strings section (if not already present), and then writing a relocation into the element bitstream.
(s string)
| 320 | // section (if not already present), and then writing a relocation |
| 321 | // into the element bitstream. |
| 322 | func (w *Encoder) String(s string) { |
| 323 | w.StringRef(w.p.StringIdx(s)) |
| 324 | } |
| 325 | |
| 326 | // StringRef writes a reference to the given index, which must be a |
| 327 | // previously encoded string value. |