Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因为我正在比较用户答案和正确答案
if(etU1.getText().toString().equals(cquestion.get(0).getAnswer()))
例如,选择是“Brad's Drink”,即使用户输入正确,它仍然是错误的,因为 getAnswer 是“Brad%$'s%# Drink”。因为我制作的 ArrayList 获取了 html 文本。有什么方法可以在将 html 文本放入数组列表之前删除它?
我认为你应该在比较之前删除“'”
String str = etU1.getText().toString().replaceAll("[']"," "); String strTwo = cquestion.get(0).getAnswer().replaceAll("[']"," "); if(str.equals(strTwo)){ ////// do your logic }