mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-28 04:01:40 +00:00
common: remove {Left, Right}PadString (#168)
Fixes #134 Those functions are unused in the whole Tendermint Github organization plus they were unnecessariy verbose and could have been concisely replaced with ```go func RightPadString(s string, totalLength uint) string { return fmt.Sprintf("% *s", totalLength, s) } func LeftPadString(s string, totalLength uint) string { return fmt.Sprintf("% -*s", totalLength, s) } ``` delete them anyways
This commit is contained in:
committed by
Anton Kaliaev
parent
b1c9b82531
commit
4b0058dd64
@ -15,24 +15,6 @@ var Fmt = func(format string, a ...interface{}) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RightPadString adds spaces to the right of a string to make it length totalLength
|
|
||||||
func RightPadString(s string, totalLength int) string {
|
|
||||||
remaining := totalLength - len(s)
|
|
||||||
if remaining > 0 {
|
|
||||||
s = s + strings.Repeat(" ", remaining)
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// LeftPadString adds spaces to the left of a string to make it length totalLength
|
|
||||||
func LeftPadString(s string, totalLength int) string {
|
|
||||||
remaining := totalLength - len(s)
|
|
||||||
if remaining > 0 {
|
|
||||||
s = strings.Repeat(" ", remaining) + s
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsHex returns true for non-empty hex-string prefixed with "0x"
|
// IsHex returns true for non-empty hex-string prefixed with "0x"
|
||||||
func IsHex(s string) bool {
|
func IsHex(s string) bool {
|
||||||
if len(s) > 2 && strings.EqualFold(s[:2], "0x") {
|
if len(s) > 2 && strings.EqualFold(s[:2], "0x") {
|
||||||
|
Reference in New Issue
Block a user