Handle prefix equal strings when comparing