mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 04:09:17 +02:00
87 string splitting by separator, not whitespace
This commit is contained in:
@@ -8,10 +8,19 @@ import (
|
||||
|
||||
// check if string is empty or contains only whitespaces
|
||||
func OnlyWhitespace(word string) bool {
|
||||
if len(strings.TrimSpace(word)) == 0 {
|
||||
return true
|
||||
return len(strings.TrimSpace(word)) == 0
|
||||
}
|
||||
|
||||
// return function to check if rune is a separator
|
||||
func IsSeparator(separator []rune) func(rune) bool {
|
||||
return func(character rune) bool {
|
||||
for _, sep := range separator {
|
||||
if sep == character {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func Contains(s []string, e string) bool {
|
||||
|
Reference in New Issue
Block a user