From aa71e27a3b0f42b980082c52232c68fb50a45052 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 2 Apr 2015 15:53:04 +0200 Subject: Detect non-valid strings for blockheight --- common/bytes.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common') diff --git a/common/bytes.go b/common/bytes.go index 2d885ac74..5bdacd810 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -127,6 +127,11 @@ func CopyBytes(b []byte) (copiedBytes []byte) { return } +func HasHexPrefix(str string) bool { + l := len(str) + return l >= 2 && str[0:2] == "0x" +} + func IsHex(str string) bool { l := len(str) return l >= 4 && l%2 == 0 && str[0:2] == "0x" -- cgit v1.2.3