mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-06 08:07:11 +00:00
common: Delete unused functions (#2452)
These functions were not used anywhere within tendermint, or the cosmos-sdk. (The functionality is already duplicated in the cosmos-sdk types package) * common: Delete unused functions within byteslice * remove more unused code from strings.go and int.go * Remove more unused code from int.go * Fix testcase
This commit is contained in:
committed by
Alexander Simmerl
parent
f76312ffe6
commit
0d6b75bd53
@@ -1,28 +1,10 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IsHex returns true for non-empty hex-string prefixed with "0x"
|
||||
func IsHex(s string) bool {
|
||||
if len(s) > 2 && strings.EqualFold(s[:2], "0x") {
|
||||
_, err := hex.DecodeString(s[2:])
|
||||
return err == nil
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// StripHex returns hex string without leading "0x"
|
||||
func StripHex(s string) string {
|
||||
if IsHex(s) {
|
||||
return s[2:]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// StringInSlice returns true if a is found the list.
|
||||
func StringInSlice(a string, list []string) bool {
|
||||
for _, b := range list {
|
||||
|
||||
Reference in New Issue
Block a user