Skip to content

hamming

hamming(a, b): number | null

Compute the Hamming distance between two strings.

The Hamming distance counts the number of positions at which the corresponding characters differ. It is only defined for strings of equal length. Returns null if the strings have different lengths.

Compares the Unicode code points of the strings as given: case, whitespace and Unicode normalization (NFC vs NFD) are not adjusted.

Parameter Type
a string
b string

number | null