ParseMultiple just takes a separator rune
This commit is contained in:
@@ -345,22 +345,11 @@ func ParseNumeric (value string) (float64, error) {
|
||||
}
|
||||
|
||||
// ParseMultiple parses multiple of a value type. Any value parsing function can
|
||||
// be specified. The multiple values should be separated by a semicolon and the
|
||||
// input string may be optionally terminated by a semicolon. Trailing empty
|
||||
// strings must always be terminated with a semicolon. Semicolons in these
|
||||
// values need to be escaped using \;.
|
||||
func ParseMultiple[T any] (parser func (string) (T, error), value string) ([]T, error) {
|
||||
return parseMultiple(parser, value, ';')
|
||||
}
|
||||
|
||||
// ParseMultipleComma is like ParseMultiple, but uses a comma as a separator
|
||||
// instead of a semicolon. This is used to parse icon theme files because the
|
||||
// freedesktop people haven't yet learned the word "consistency".
|
||||
func ParseMultipleComma[T any] (parser func (string) (T, error), value string) ([]T, error) {
|
||||
return parseMultiple(parser, value, ',')
|
||||
}
|
||||
|
||||
func parseMultiple[T any] (parser func (string) (T, error), value string, sep rune) ([]T, error) {
|
||||
// be specified. The multiple values should be separated by a separator and the
|
||||
// input string may be optionally terminated by a separator. Trailing empty
|
||||
// strings must always be terminated with a separator. Separators in these
|
||||
// values need to be escaped using \<sep>.
|
||||
func ParseMultiple[T any] (parser func (string) (T, error), value string, sep rune) ([]T, error) {
|
||||
values := []T { }
|
||||
builder := strings.Builder { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user