Compare Functions in MR-lib
© 2012, Martin Rinehart
array.sort( compare_nocase(a, b) );
Compare copies of two strings, both converted to uppercase. Returns 1 if the first is greater, 0 if the two are equal, -1 if the second is greater (for use in sorts).
array.sort( compare_numbers(a, b) );
Compare two numbers. Returns 1 if the first is greater, 0 if the two are equal, -1 if the second is greater (for use in sorts).
rows.sort( compare_numbers_and_strings(a, b) );
Compare database fields. If one is a number, it is "greater". If neither is a number, they are compared as strings. If they are equal, returns -1 (second is greater) to preserve order of the original records.
array.sort( compare_reverse(a, b) );
Compare numbers/strings in a database in descending order. Returns negation of the result of
Feedback: MartinRinehart at gmail dot com
# # #