# difference() [v3]

作者: toralf 最近更新时间: 20100621

Calculates the difference between two strings. Works faster than Levenshtein distance.

Difference(string1, string2, maxOffset=5)

关于函数的参数和返回值, 请参阅其源码或 此文档.

#### 备注

The original algorithm can be found here: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
See also Damerau朙evenshtein distance library: GUID=683cc900-9ec7-126a-9f10-15a625f9f073
The script does not have any official version number. I *Tuncay* have put one, because it is the third version he posted. And it does not have any documentation, so I made a simple one.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/post-364091.html#364091

#### 许可

不存在

#### 示例

    ; #Include difference.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

    MsgBox % Difference( "A H K", "A H Kn" )       ;0.083333
    MsgBox % Difference( "A H K", "A H K" )        ;0.000000
    MsgBox % Difference( "A H K", "A h K" )        ;0.040000
    MsgBox % Difference( "AHK", "" )               ;1.000000
    MsgBox % Difference( "He", "Ben" )             ;0.500000
    MsgBox % Difference( "Toralf", "ToRalf" )      ;0.033333
    MsgBox % Difference( "Toralf", "esromneb" )    ;0.750000
    MsgBox % Difference( "Toralf", "RalfLaDuce" )  ;0.420000