bytes_safe.go 479 B

12345678910111213141516171819202122232425
  1. // +build appengine appenginevm
  2. package jsonparser
  3. import (
  4. "strconv"
  5. )
  6. // See fastbytes_unsafe.go for explanation on why *[]byte is used (signatures must be consistent with those in that file)
  7. func equalStr(b *[]byte, s string) bool {
  8. return string(*b) == s
  9. }
  10. func parseFloat(b *[]byte) (float64, error) {
  11. return strconv.ParseFloat(string(*b), 64)
  12. }
  13. func bytesToString(b *[]byte) string {
  14. return string(*b)
  15. }
  16. func StringToBytes(s string) []byte {
  17. return []byte(s)
  18. }