"Fuzzy Match" for the specified number of consecutive character strings in the array

Source: Internet
Author: User

A requirement is a numeric value entered in multiple input boxes, continuously entering a specified number of character text,

cannot be duplicated in other inputs, so a matching state is returned using fuzzy matching,

Look at the following code in detail:

/** Three company name Fuzzy match * @param Strarr needs to match the string array * @param len needs to match the minimum consecutive character length*/functionComnamecompare (strarr,len) {varresult = '; if(Strarr.length = = 3) {//requirements are three input boxes must be filled, the following is the fuzzy matching method         for(vari = 0;i< strarr.length; i++ ){             for(varj = 0;j< Strarr[i].length-len; J + + ){                varstr = Strarr[i].slice (j,j+Len); varTemparr = Strarr.slice (0);//array does not change a single copy of the original dataTemparr.splice (i,1);  for(vark = 0; k< temparr.length; k++ ){                    varIsIn =temparr[k].indexof (str); if(IsIn >-1) {result= "Repeat"; returnresult; }Else{result= "Through"; returnresult; }                }            }        }        returnresult; }Else{alert ("Companies that need to fill in three comparisons!" "); }}

"Fuzzy Match" for the specified number of consecutive character strings in the array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.