比较两个文本字段的文本 [英] Compare the text of two text fields

查看:102
本文介绍了比较两个文本字段的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何比较两个文本字段中的文本,看看它们是否相同,例如在密码和确认密码文本字段中?

  if(passwordField == passwordConfirmField){

//它们彼此相等

} else {

//它们不相等

}


  if([passwordField.text isEqualToString:passwordConfirmField.text] )
{
//它们彼此相等
}
else
{
//它们不相等
}


How do you compare the text in two text fields to see if they are the same, such as in "Password" and "Confirm Password" text fields?

if (passwordField == passwordConfirmField) {

    //they are equal to each other

} else {

    //they are not equal to each other

}

解决方案

Did you try this ?

if ([passwordField.text isEqualToString:passwordConfirmField.text])
{
    //they are equal to each other
}
else
{
    //they are not equal to each other
}

这篇关于比较两个文本字段的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆