Let's say I have a list of random URLs, the URLs are fully formed:
http://www.example1.com, http://example2.biz, http://www.example3.co.uk
and I have the value My url from the text box and dropDownList for urlSufix
so the user inserts the url:
label: www. , textBox [insert the domainNameOnly] , DDL [.com, .biz, .co.uk, .net, .info]
and say the user typed "example3" and selected sufix ".biz"
so my value is "example3.biz"
I need a method to compare URLs in a list for user input
I thought I just split the string ('.')
therefore the parameters for the prefix:
www.example
or simply
example
for sufix
example.com \ biz \net \info -> (2 parts) example.co.uk \org.uk (3 parts)
so you have many options
may be prefixed with aray has 2 elements
www.example
and sufix with 3 example.co.uk
hard to check it
I chose the wrong path using compareisson techniq to split the urls into dots?
I will just show you how I started, and I stopped as soon as I noticed that it was too much.
it does not cover all parameters and is already too complicated
if (ListArr[0] != "www") { // it means no www so compare userArr[0] to ListArr[0] // to check domainMatch // and for suffix of domain var DDLValueArr = DDLValue.split('.'); if(DDLValueArr.length > 1) means it is co.uk or org.uk etc' { compare DDLValueArr[0] to ListArr[1] } } else compare userArr[0] to ListArr[1] cause the url in the List starts with "www"
What is a good approach for comparing user data with a list of URLs?