helper functions
This commit is contained in:
parent
72942d5e2b
commit
82144c737c
|
@ -1,6 +1,9 @@
|
||||||
package text
|
package text
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func Filter(s string) string {
|
func Filter(s string) string {
|
||||||
output := strings.Replace(s, string(rune(1)), "", -1)
|
output := strings.Replace(s, string(rune(1)), "", -1)
|
||||||
|
@ -24,6 +27,16 @@ func ContainsAllowedChars(toTest, allowedChars string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ContainsANumber(text string) bool {
|
||||||
|
for _, l := range text {
|
||||||
|
if _, err := strconv.Atoi(string(l)); err == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static boolean hasAllowedCharacters(String str, String allowedChars) {
|
public static boolean hasAllowedCharacters(String str, String allowedChars) {
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
|
|
Loading…
Reference in New Issue