MCPcopy Create free account
hub / github.com/gobeam/stringy / First

Method First

stringy.go:181–188  ·  view source on GitHub ↗

First returns first n characters from provided input. It removes all spaces in string before doing so.

(length int)

Source from the content-addressed store, hash-verified

179
180// First returns first n characters from provided input. It removes all spaces in string before doing so.
181func (i *input) First(length int) string {
182 input := getInput(*i)
183 input = strings.ReplaceAll(input, " ", "")
184 if len(input) < length {
185 panic(errors.New(LengthError))
186 }
187 return input[0:length]
188}
189
190// Get simply returns result and can be chained on function which
191// returns StringManipulation interface

Callers

nothing calls this directly

Calls 1

getInputFunction · 0.85

Tested by

no test coverage detected