Ruby - 包括?相关问题

时间:2017-08-15 09:42:12

标签: ruby

任何人都可以帮我解决以下代码行中包含的错误的核心问题吗?

main_frame.html.include? =~ /Your credit card does not have any statements|No activity is found in your credit card/i

2 个答案:

答案 0 :(得分:3)

您正在调用两种方法include?=~。前者采用论证,因此不能成为=~的论据。

答案 1 :(得分:2)

您可能想要使用以下某项之一:

!!(/Your credit card does not have any statements|No activity is found in your credit card/i.match main_frame.html)

include?

或(使用[ 'Your credit card does not have any statements', 'No activity is found in your credit card' ].any? do |t| main_frame.html.include? t end 但没有正则表达式)

try {
    //your code for login goes here....
} catch (UnknownHostException e) {
    Toast.makeText(getApplicationContext(), "Unable to connect!", Toast.LENGTH_SHORT).show();
}