Q: Google Spreadsheet - How to compares two strings and gives it a similarity score? I'm wonder how can Google Spreadsheet give a similarity Score for 2 strings
What I want is this :
sample spreadsheet
I'm looking for a miracle to make Spreadsheet auto calculate Similarity score then fill in. I found a VBA code but don't know how to convert to GAS :( (i mentioned here : https://productforums.google.com/d/msg/docs/0zg-BV3KrHo/XInEthmHAwAJ)
Any help would be greatly appreciated.
Thanks and have a nice day !

A: This may get you pointed in the right direction. 


function similar() {
  
    var a = "test";
    var b = "tes";
    var lengthA = a.length;
    var lengthB = b.length;
    var equivalency = 0;
    var minLength = (a.length > b.length) ? b.length : a.length;    
    var maxLength = (a.length < b.length) ? b.length : a.length;    
    for(var i = 0; i < minLength; i++) {
        if(a[i] == b[i]) {
            equivalency++;
        }
    }


    var weight = equivalency / maxLength * 100;
  Logger.log(weight)
}


