MCPcopy Create free account
hub / github.com/tidwall/gjson / validstring

Function validstring

gjson.go:2614–2645  ·  view source on GitHub ↗
(data []byte, i int)

Source from the content-addressed store, hash-verified

2612 return i, false
2613}
2614func validstring(data []byte, i int) (outi int, ok bool) {
2615 for ; i < len(data); i++ {
2616 if data[i] < ' ' {
2617 return i, false
2618 } else if data[i] == '\\' {
2619 i++
2620 if i == len(data) {
2621 return i, false
2622 }
2623 switch data[i] {
2624 default:
2625 return i, false
2626 case '"', '\\', '/', 'b', 'f', 'n', 'r', 't':
2627 case 'u':
2628 for j := 0; j < 4; j++ {
2629 i++
2630 if i >= len(data) {
2631 return i, false
2632 }
2633 if !((data[i] >= '0' && data[i] <= '9') ||
2634 (data[i] >= 'a' && data[i] <= 'f') ||
2635 (data[i] >= 'A' && data[i] <= 'F')) {
2636 return i, false
2637 }
2638 }
2639 }
2640 } else if data[i] == '"' {
2641 return i + 1, true
2642 }
2643 }
2644 return i, false
2645}
2646func validnumber(data []byte, i int) (outi int, ok bool) {
2647 i--
2648 // sign

Callers 2

validanyFunction · 0.85
validobjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…