Infobar prompts

This commit is contained in:
Zachary Yedidia
2018-12-31 23:47:24 -05:00
parent c50e0cb932
commit afe24698ea
7 changed files with 170 additions and 15 deletions

View File

@@ -155,6 +155,17 @@ func IsSpaces(str []byte) bool {
return true
}
// IsSpacesOrTabs checks if a given string contains only spaces and tabs
func IsSpacesOrTabs(str []byte) bool {
for _, c := range str {
if c != ' ' && c != '\t' {
return false
}
}
return true
}
// IsWhitespace returns true if the given rune is a space, tab, or newline
func IsWhitespace(c rune) bool {
return c == ' ' || c == '\t' || c == '\n'
@@ -247,3 +258,8 @@ func GetLeadingWhitespace(b []byte) []byte {
}
return ws
}
// IntOpt turns a float64 setting to an int
func IntOpt(opt interface{}) int {
return int(opt.(float64))
}