Skip to content

Commit 7caa910

Browse files
committed
Improved GetBoolean (added trimspace)
1 parent 10dff42 commit 7caa910

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

objects.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
package properties
3131

3232
import (
33+
"strings"
34+
3335
"github.com/arduino/go-paths-helper"
3436
)
3537

3638
// GetBoolean returns true if the map contains the specified key and the value
3739
// equals to the string "true", in any other case returns false.
3840
func (m *Map) GetBoolean(key string) bool {
3941
value, ok := m.GetOk(key)
40-
return ok && value == "true"
42+
return ok && strings.TrimSpace(value) == "true"
4143
}
4244

4345
// SetBoolean sets the specified key to the string "true" or "false" if the value

0 commit comments

Comments
 (0)