mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
Strutil: HammingDistance func (#197)
* Strutil: HammingDistance func The Hamming distance is the number of positions at which the corresponding symbols are different * Add hamming distance doc
This commit is contained in:
1 parent
3d1bd08434
commit
0b5e884371
5 files changed
+125
No files matched your search
@@ -667,3 +667,16 @@ func ExampleSubInBetween() {
|
||||
// abc
|
||||
// bc
|
||||
}
|
||||
|
||||
func ExampleHammingDistance() {
|
||||
|
||||
result, _ := HammingDistance("abc", "def")
|
||||
fmt.Println(result)
|
||||
|
||||
result, _ = HammingDistance("name", "namf")
|
||||
fmt.Println(result)
|
||||
|
||||
// Output:
|
||||
// 3
|
||||
// 1
|
||||
}
|
||||
Reference in new issue
Block a user