type-conversion - 在 WSO2 Integration Studio 中将 double 转换为整数

标签 type-conversion wso2 wso2-esb wso2-enterprise-integrator wso2-integration-studio

我正在 XPath 表达式中执行算术运算。在下面的代码中,qty1和qty2是双倍的,因此我得到的结果是双倍的。我想将结果转换为整数并将其保存在属性中。如何在 WSO2 Integration Studio 中实现它?

<property name="RESULT_QTY" expression="($body/*[local-name()='Shipment']/*[local-name()='qty1'])-($body/*[local-name()='Shipment']/*[local-name()='qty2'])"/>

最佳答案

您可以执行如下操作。

<property name="double" scope="default" type="DOUBLE" value="10.0"/>
<property name="doubleString" scope="default" expression="$ctx:double" type="STRING"/>
<property expression="fn:substring-before($ctx:doubleString, '.')" name="integer" scope="default" />

关于type-conversion - 在 WSO2 Integration Studio 中将 double 转换为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73251386/

相关文章:

c++ - 从 C++ 数据结构到 Swift 的类型转换

ios - 在 Swift 中从子字符串创建特殊的 UIButtons 文本

WSO2 是联合 IdP

java - Siddhi 是否无法按多个变量进行分组?

ssl - 系统无法从 xxxx url 推断传输信息

java - 无法接合壁垒模块。 WSO2 IS 客户端示例

scala - Seq[Int]和List[Int]的区别和转换

c# - 将字节数组(从读取文件)转换为字符串

wso2 - 选择简单的 Apache Synapse 与 WSO2 的标准

wso2 - 使用 wso2 6.1 Enrich mediator 从 xml 中删除标签