Top "Comparison" questions

Questions about data comparison and efficient ways to accomplish it.

Is there a standard function to check for null, undefined, or blank variables in JavaScript?

Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not undefined …

javascript null comparison undefined
Sort array of objects by string property value

I have an array of JavaScript objects: var objs = [ { first_nom: 'Lazslo', last_nom: 'Jamf' }, { first_nom: 'Pig', last_nom: …

javascript arrays sorting comparison
Why does comparing strings using either '==' or 'is' sometimes produce a different result?

I've got a Python program where two variables are set to the value 'public'. In a conditional expression I have …

python string comparison identity equality
How do I check for null values in JavaScript?

How can I check for null values in JavaScript? I wrote the code below but it didn't work. if (pass == …

javascript null compare comparison
String comparison in Python: is vs. ==

I noticed a Python script I was writing was acting squirrelly, and traced it to an infinite loop, where the …

python string comparison equality
Object comparison in JavaScript

What is the best way to compare objects in JavaScript? Example: var user1 = {name : "nerd", org: "dev"}; var user2 = {name : "…

javascript object comparison object-comparison
How to compare dates in Java?

How do I compare dates in between in Java? Example: date1 is 22-02-2010 date2 is 07-04-2010 today date3 …

java date comparison
How do I do a case-insensitive string comparison?

How can I do case insensitive string comparison in Python? I would like to encapsulate comparison of a regular strings …

python comparison case-insensitive
Optimum way to compare strings in JavaScript?

I am trying to optimize a function which does binary search of strings in JavaScript. Binary search requires you to …

javascript string optimization comparison binary-search
In Bash, how can I check if a string begins with some value?

I would like to check if a string begins with "node" e.g. "node001". Something like if [ $HOST == user* ] then …

string bash comparison