Skip to content

Commit e1c9892

Browse files
+fix
1 parent 309e560 commit e1c9892

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tinyHelper.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package tinyHelper as wrappers - shorters
2+
// with the some helping functions
13
package tinyHelper
24

35
import (
@@ -49,7 +51,7 @@ func toBaseOther(v, base int) string {
4951
// ToBase[GeneralTypes](T, int, int, ...int) string
5052
// Wrapper for convert from one base to another base
5153
func ToBase[T GeneralTypes](val T, from, to int, prefixNulls ...int) (nv string) {
52-
to10 := ToInt(val, from)
54+
to10 := ToInt(val, from)
5355
nv = ToStr(to10)
5456
prx := ""
5557
if prefixNulls != nil || len(prefixNulls) > 0 {
@@ -63,7 +65,7 @@ func ToBase[T GeneralTypes](val T, from, to int, prefixNulls ...int) (nv string)
6365
case 16:
6466
nv = fmt.Sprintf("%"+prfBase+prx+Base16, to10)
6567
default:
66-
nv = fmt.Sprintf("%"+prfBase+prx+"v", toBaseOther(to10, to))
68+
nv = fmt.Sprintf("%"+prfBase+prx+"v", toBaseOther(to10, to))
6769
}
6870
return
6971
}
@@ -82,15 +84,15 @@ func ToNum[T1 NumsTypes, T GeneralTypes](val T, base ...int) T1 {
8284
// Del prefix. Parse values with prefix 0b, 0o, 0x works if base '0' value in parameter.
8385
if len(f) >= 2 {
8486
switch {
85-
case f[:2] == (prfBase + Base02) && parBase == 16:
86-
case f[:2] == (prfBase + Base02):
87-
parBase = 2
87+
case f[:2] == (prfBase+Base02) && parBase == 16:
88+
case f[:2] == (prfBase + Base02):
89+
parBase = 2
8890
f = f[2:]
8991
case f[:2] == (prfBase + Base08):
90-
parBase = 8
92+
parBase = 8
9193
f = f[2:]
9294
case f[:2] == (prfBase + Base16):
93-
parBase = 16
95+
parBase = 16
9496
f = f[2:]
9597
}
9698
}

0 commit comments

Comments
 (0)