MCPcopy Index your code
hub / github.com/gavv/httpexpect / Length

Method Length

string.go:117–126  ·  view source on GitHub ↗

Length returns a new Number instance with string length. Example: str := NewString(t, "Hello") str.Length().IsEqual(5)

()

Source from the content-addressed store, hash-verified

115// str := NewString(t, "Hello")
116// str.Length().IsEqual(5)
117func (s *String) Length() *Number {
118 opChain := s.chain.enter("Length()")
119 defer opChain.leave()
120
121 if opChain.failed() {
122 return newNumber(opChain, 0)
123 }
124
125 return newNumber(opChain, float64(len(s.value)))
126}
127
128// IsEmpty succeeds if string is empty.
129//

Callers 1

TestString_GettersFunction · 0.95

Calls 4

newNumberFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 1

TestString_GettersFunction · 0.76