I have a string like (12345; 5678). I need to compare this value with another string (63434; 33434). Need to compare each value seperated with ; with the values in the 2nd string. I know this can be done by passing into array. But can someone help me give me the correct code to do this
A quick example to show you how you can get each element.
var str1 = "12345; 5678"; var str2 = "63434; 33434"; var arr1 = str1.split(";"); var arr2 = str2.split(";"); var str1a = arr1.trim(); var str1b = arr1.trim(); var str2a = arr2.trim(); var str2b = arr2.trim(); alert (str1a + ":" + str1b + " - " + str2a + ":" + str2b);
thanks… But i already got the answer. I wanted to compare each value of the 1st array with all the values in the other one. I did it using 2 for loops…