#Removing trailing & leading spaces on a multiline string

5 messages · Page 1 of 1 (latest)

visual cliff
#

regex ?

modest lintel
#

Id scan each line, use strings.TrimSpace

#

and put them in another buffer as an output

severe deltaBOT
#
type Scanner struct {
    // contains filtered or unexported fields
}

Scanner provides a convenient interface for reading data such as a file of newline-delimited lines of text. Successive calls to the Scan method will step through the 'tokens' of a file, skipping the bytes between the tokens. The specification of a token is defined by a split function of type SplitFunc; the default split function breaks the input into lines with line termination stripped. Split functions are defined in this package for scanning a file into lines, bytes, UTF-8-encoded runes, and space-delimited words. The client may instead provide a custom split function....

More documentation omitted