我正在尝试在 Beanshell 中运行一个简单的 switch-case 语句
这是我试图运行的代码——
temp = assignee.toString();
switch( temp.toString() )
{
case 'missing' : check = "missing"; break;
case '404' : check = "404"; break;
default: check = "data"; break;
}
但我收到以下错误 -
ERROR - Error during script execution: Sourced file: inline evaluation of: ``temp = assignee.toString(); switch( temp.toString() ) { case 'missing' : check = . . . '' Token Parsing Error: Lexical error at line 3, column 8. Encountered: "i" (105), after : "\'m"
org.webharvest.exception.ScriptException: Error during script execution: Sourced file: inline evaluation of: ``temp = assignee.toString(); switch( temp.toString() ) { case 'missing' : check = . . . '' Token Parsing Error: Lexical error at line 3, column 8.
Encountered: "i" (105), after : "\'m"
at org.webharvest.runtime.scripting.BeanShellScriptEngine.eval(Unknown Source)
我在这里做错了什么?如何解决此错误?