Android String Comparison Not Working

前端 未结 2 2003
迷失自我
迷失自我 2021-01-20 05:50

I am having hard time comparing two strings in Android using Java, what I am doing is running HTTP get request which return yes or no and based on that I decide whether to l

相关标签:
2条回答
  • 2021-01-20 06:30

    try this

    str1.toLowerCase().contains(str2.toLowerCase())

    it work for me

    0 讨论(0)
  • 2021-01-20 06:50

    There might be some white space in result.

    Try trimming it.

    result.trim().equals("yes")
    
    0 讨论(0)
提交回复
热议问题