Fully implemented string compare function.