MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / firstLine

Function firstLine

internal/cmdhelp/json.go:504–509  ·  view source on GitHub ↗

firstLine returns the first line of s with surrounding whitespace trimmed. Useful for collapsing a multi-line Long string into a Summary.

(s string)

Source from the content-addressed store, hash-verified

502// firstLine returns the first line of s with surrounding whitespace
503// trimmed. Useful for collapsing a multi-line Long string into a Summary.
504func firstLine(s string) string {
505 if i := strings.IndexByte(s, '\n'); i >= 0 {
506 return strings.TrimSpace(s[:i])
507 }
508 return strings.TrimSpace(s)
509}
510
511// stripCommentIndex returns the position of an unquoted `#` that begins
512// a same-line comment in s, or -1 if no such comment exists. Comments

Callers 3

BuildFunction · 0.70
buildCommandFunction · 0.70

Calls

no outgoing calls

Tested by 1