Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f6bcdc9903
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.240"
|
const GoextVersion = "0.0.242"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-08-14T15:36:12+0200"
|
const GoextVersionTimestamp = "2023-08-14T16:05:12+0200"
|
||||||
|
@ -467,3 +467,15 @@ func ArrayToInterface[T any](t []T) []interface{} {
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func JoinString(arr []string, delimiter string) string {
|
||||||
|
str := ""
|
||||||
|
for i, v := range arr {
|
||||||
|
str += v
|
||||||
|
if i < len(arr)-1 {
|
||||||
|
str += delimiter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
12
langext/array_test.go
Normal file
12
langext/array_test.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package langext
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gogs.mikescher.com/BlackForestBytes/goext/tst"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestJoinString(t *testing.T) {
|
||||||
|
ids := []string{"1", "2", "3"}
|
||||||
|
res := JoinString(ids, ",")
|
||||||
|
tst.AssertEqual(t, res, "1,2,3")
|
||||||
|
}
|
@ -60,9 +60,3 @@ func TestBase58FlickrDecoding(t *testing.T) {
|
|||||||
tst.AssertEqual(t, _decStr(t, Base58FlickrEncoding, "9aJCVZR"), "Hello")
|
tst.AssertEqual(t, _decStr(t, Base58FlickrEncoding, "9aJCVZR"), "Hello")
|
||||||
tst.AssertEqual(t, _decStr(t, Base58FlickrEncoding, "48638rmBiUzG5NKQoX4KcuE5C8paCFACnE28F7qDx13PRtennAmYSSJQ5gJSRihf5ZDyEQS4UimtihR7uARt4wbty2fW9duTQTM9n1DwUBevreyzGwu6W4YSgrvQgCPDxsiE1mCdZsF8VEBpuHHEiJyw"), "If debugging is the process of removing software bugs, then programming must be the process of putting them in.")
|
tst.AssertEqual(t, _decStr(t, Base58FlickrEncoding, "48638rmBiUzG5NKQoX4KcuE5C8paCFACnE28F7qDx13PRtennAmYSSJQ5gJSRihf5ZDyEQS4UimtihR7uARt4wbty2fW9duTQTM9n1DwUBevreyzGwu6W4YSgrvQgCPDxsiE1mCdZsF8VEBpuHHEiJyw"), "If debugging is the process of removing software bugs, then programming must be the process of putting them in.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertEqual(t *testing.T, actual string, expected string) {
|
|
||||||
if actual != expected {
|
|
||||||
t.Errorf("values differ: Actual: '%v', Expected: '%v'", actual, expected)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user