firstLine returns the first line of s with surrounding whitespace trimmed. Useful for collapsing a multi-line Long string into a Summary.
(s string)
| 502 | // firstLine returns the first line of s with surrounding whitespace |
| 503 | // trimmed. Useful for collapsing a multi-line Long string into a Summary. |
| 504 | func 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 |
no outgoing calls