Sort list of strings ignoring upper/lower case

The sort() method and the sorted() function take a key argument: var.sort(key=lambda v: v.upper()) The function named in key is called for each value and the return value is used when sorting, without affecting the actual values: >>> var=[‘ant’,’bat’,’cat’,’Bat’,’Lion’,’Goat’,’Cat’,’Ant’] >>> sorted(var, key=lambda v: v.upper()) [‘ant’, ‘Ant’, ‘bat’, ‘Bat’, ‘cat’, ‘Cat’, ‘Goat’, ‘Lion’] To sort Ant … Read more

String Comparison in Java

Leading from answers from @Bozho and @aioobe, lexicographic comparisons are similar to the ordering that one might find in a dictionary. The Java String class provides the .compareTo () method in order to lexicographically compare Strings. It is used like this “apple”.compareTo (“banana”). The return of this method is an int which can be interpreted … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)