D'ish similar_text?

Vladimir Panteleev thecybershadow.lists at gmail.com
Thu May 10 20:38:12 UTC 2018


On Thursday, 10 May 2018 at 20:32:11 UTC, Dgame wrote:
>     immutable size_t len = s1.length + s2.length;
>     percent = (len - distance) * 100.0 / len;

Note that this formula will give you only 50% similarity for 
"abc" and "def", i.e. two completely different strings. I suggest 
to divide by max(s1.length, s2.length) instead.


More information about the Digitalmars-d-learn mailing list