Length returns a new Number instance with number of submatches. Example: m := NewMatch(t, submatches, names) m.Length().IsEqual(len(submatches))
()
| 96 | // m := NewMatch(t, submatches, names) |
| 97 | // m.Length().IsEqual(len(submatches)) |
| 98 | func (m *Match) Length() *Number { |
| 99 | opChain := m.chain.enter("Length()") |
| 100 | defer opChain.leave() |
| 101 | |
| 102 | if opChain.failed() { |
| 103 | return newNumber(opChain, 0) |
| 104 | } |
| 105 | |
| 106 | return newNumber(opChain, float64(len(m.submatchValues))) |
| 107 | } |
| 108 | |
| 109 | // Submatch returns a new String instance with submatch for given index. |
| 110 | // |