我想将流变量与文字字符串进行比较,并忽略变量的大小写.例如
...
<when expression="#[StringUtils.upperCase(flowVars['officeCode']) == 'REGION1']">
....
Run Code Online (Sandbox Code Playgroud)
产生的错误是[错误:无法访问:StringUtils; 在课堂上:null] [近:{...未知....}]
我也试过了
<when expression="#[regex('[a-zA-Z0-9]+',flowVars['officeCode'],Pattern.CASE_INSENSITIVE) == 'REGION1']">
Run Code Online (Sandbox Code Playgroud)
对于正则表达式比较,我收到错误"文本不是字符串"
任何帮助非常感谢.
对于第一个,您需要完全限定StringUtils类,即
#[org.apache.commons.lang3.StringUtils.upperCase(.....)]
Run Code Online (Sandbox Code Playgroud)
或者您可以全局导入该类,以便您可以在不使用完整限定符的情况下引用它:
<configuration>
<expression-language>
<import class=”org.apache.commons.lang3.StringUtils” />
</expression-language>
</configuration>
Run Code Online (Sandbox Code Playgroud)
或者你可以在String上使用equalsIgnoreCase:
<when expression="#[flowVars['officeCode'].equalsIgnoreCase('REGION1')]">
Run Code Online (Sandbox Code Playgroud)
只要#[flowVars ['officeCode']实际上是一个String
| 归档时间: |
|
| 查看次数: |
5551 次 |
| 最近记录: |