Java. Ignore accents when comparing strings

I think you should be using the Collator class. It allows you to set a strength and locale and it will compare characters appropriately. From the Java 1.6 API: You can set a Collator’s strength property to determine the level of difference considered significant in comparisons. Four strengths are provided: PRIMARY, SECONDARY, TERTIARY, and IDENTICAL. … Read more

Compare 2 JSON objects [duplicate]

Simply parsing the JSON and comparing the two objects is not enough because it wouldn’t be the exact same object references (but might be the same values). You need to do a deep equals. From http://threebit.net/mail-archive/rails-spinoffs/msg06156.html – which seems the use jQuery. Object.extend(Object, { deepEquals: function(o1, o2) { var k1 = Object.keys(o1).sort(); var k2 = … Read more

Checking for duplicate strings in JavaScript array

The findDuplicates function (below) compares index of all items in array with index of first occurrence of same item. If indexes are not same returns it as duplicate. let strArray = [ “q”, “w”, “w”, “w”, “e”, “i”, “u”, “r”]; let findDuplicates = arr => arr.filter((item, index) => arr.indexOf(item) != index) console.log(findDuplicates(strArray)) // All duplicates … Read more

Compare RGB colors in c#

What you are looking for is called Delta-E. http://www.colorwiki.com/wiki/Delta_E:_The_Color_Difference It is the distance between two colors in LAB color space. It is said that the human eye cannot distinguish colors below 1 DeltaE (I find that my eyes can find differences in colors below 1 DeltaE, each person is different.) There are 4 formulas for … Read more