MCPcopy Create free account
hub / github.com/antchfx/xpath / stringLengthFunc

Function stringLengthFunc

func.go:546–560  ·  view source on GitHub ↗

stringLengthFunc is XPATH string-length( [string] ) function that returns a number equal to the number of characters in a given string.

(arg1 query)

Source from the content-addressed store, hash-verified

544// stringLengthFunc is XPATH string-length( [string] ) function that returns a number
545// equal to the number of characters in a given string.
546func stringLengthFunc(arg1 query) func(query, iterator) interface{} {
547 return func(_ query, t iterator) interface{} {
548 switch v := functionArgs(arg1).Evaluate(t).(type) {
549 case string:
550 return float64(len(v))
551 case query:
552 node := v.Select(t)
553 if node == nil {
554 break
555 }
556 return float64(len(node.Value()))
557 }
558 return float64(0)
559 }
560}
561
562// translateFunc is XPath functions translate() function returns a replaced string.
563func translateFunc(arg1, arg2, arg3 query) func(query, iterator) interface{} {

Callers 1

processFunctionMethod · 0.85

Calls 4

functionArgsFunction · 0.85
EvaluateMethod · 0.65
SelectMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…