From 82144c737ca64e9b90b990993e59a2751f2b589e Mon Sep 17 00:00:00 2001 From: jtieri <37750742+jtieri@users.noreply.github.com> Date: Thu, 16 Sep 2021 23:07:33 -0500 Subject: [PATCH] helper functions --- habbgo/text/string.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/habbgo/text/string.go b/habbgo/text/string.go index 3116807..b2e1904 100644 --- a/habbgo/text/string.go +++ b/habbgo/text/string.go @@ -1,6 +1,9 @@ package text -import "strings" +import ( + "strconv" + "strings" +) func Filter(s string) string { output := strings.Replace(s, string(rune(1)), "", -1) @@ -24,6 +27,16 @@ func ContainsAllowedChars(toTest, allowedChars string) bool { 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) { if (str == null) {