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.