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

Method Last

stringy.go:210–219  ·  view source on GitHub ↗

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

(length int)

Source from the content-addressed store, hash-verified

208
209// Last returns last n characters from provided input. It removes all spaces in string before doing so.
210func (i *input) Last(length int) string {
211 input := getInput(*i)
212 input = strings.ReplaceAll(input, " ", "")
213 inputLen := len(input)
214 if len(input) < length {
215 panic(errors.New(LengthError))
216 }
217 start := inputLen - length
218 return input[start:inputLen]
219}
220
221// LcFirst simply returns result by lower casing first letter of string and it can be chained on
222// function which return StringManipulation interface

Callers

nothing calls this directly

Calls 1

getInputFunction · 0.85

Tested by

no test coverage detected