mirror of
https://github.com/duke-git/lancet.git
synced 2026-03-01 00:35:28 +08:00
doc: update doc for new added functions
This commit is contained in:
@@ -466,12 +466,6 @@ func TestGbkToUtf8(t *testing.T) {
|
|||||||
assert.Equal("hello", string(utf8Data))
|
assert.Equal("hello", string(utf8Data))
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeBase64(data []byte) ([]byte, error) {
|
|
||||||
buf := make([]byte, base64.StdEncoding.DecodedLen(len(data)))
|
|
||||||
n, err := base64.StdEncoding.Decode(buf, data)
|
|
||||||
return buf[:n], err
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestToStdBase64(t *testing.T) {
|
func TestToStdBase64(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
assert := internal.NewAssert(t, "TestToStdBase64")
|
assert := internal.NewAssert(t, "TestToStdBase64")
|
||||||
|
|||||||
@@ -599,6 +599,7 @@ func SubInBetween(str string, start string, end string) string {
|
|||||||
// HammingDistance calculates the Hamming distance between two strings.
|
// HammingDistance calculates the Hamming distance between two strings.
|
||||||
// The Hamming distance is the number of positions at which the corresponding symbols are different.
|
// The Hamming distance is the number of positions at which the corresponding symbols are different.
|
||||||
// This func returns an error if the input strings are of unequal lengths.
|
// This func returns an error if the input strings are of unequal lengths.
|
||||||
|
// Play: todo
|
||||||
func HammingDistance(a, b string) (int, error) {
|
func HammingDistance(a, b string) (int, error) {
|
||||||
if len(a) != len(b) {
|
if len(a) != len(b) {
|
||||||
return -1, errors.New("a length and b length are unequal")
|
return -1, errors.New("a length and b length are unequal")
|
||||||
|
|||||||
Reference in New Issue
Block a user