Browse Source

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
pull/1780/head
Emmanuel T Odeke 6 years ago
committed by Anton Kaliaev
parent
commit
4b0058dd64
1 changed files with 0 additions and 18 deletions
  1. +0
    -18
      common/string.go

+ 0
- 18
common/string.go View File

@ -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"
func IsHex(s string) bool {
if len(s) > 2 && strings.EqualFold(s[:2], "0x") {


Loading…
Cancel
Save