Enforcing correct sort order for formatted strings