Refactoring functions about comparing with c-str.