compute the Hamming distance between two strings
HammingDistance( s, t )
The HammingDistance(s,t) command returns an integer measure of the distance between the two strings s and t.
The Hamming distance between two strings s and t, of equal length, is the number of character positions where they differ. If strings s and t have respective lengths m and n where, without loss of generality, n<m, then the generalized Hamming distance between s and t is defined to be (m - n) + HammingDistance( s[ 1 .. n ], t ). The HammingDistance procedure computes this generalized metric.
For a different notion of the distance between two strings, see StringTools[Levenshtein].
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
Since it is a metric, the Hamming distance satisfies the triangle inequality.
Download Help Document
What kind of issue would you like to report? (Optional)