ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 ``` /** * @category 字符串去空格 * @param instr * 入参|输入字符串|{@link java.lang.String} * @param trimflag * 入参|截取标志 trim-截取两边 all-截取所有| {@link java.lang.String} * @param outstr * 出参|返回字符串|{@link java.lang.String} * @return 1 成功<br/> */ @InParams(param = { @Param(name = "instr", comment = "输入字符串", type = java.lang.String.class), @Param(name = "trimflag", comment = "截取标志 trim-截取两边 all-截取所有", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "outstr", comment = "返回字符串", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "1", desp = "成功") }) @Component(label = "字符串去空格", style = "处理型", type = "同步组件", comment = "截取字符串两边或全部空格", version = "1.0.0", deprecated = false, author = "test", date = "2018-01-15 03:39:34") public static ResultBase P_trimStr(String instr, String trimflag) { if (instr == null || instr == "") { return ResultBase.newSuccessResult(instr); } if ("trim".equalsIgnoreCase(trimflag)) { return ResultBase.newSuccessResult(instr.trim()); } return ResultBase.newSuccessResult(instr.replaceAll(" ", "")); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/db/ff/dbff2699f97f4a0b3b3dd99bf99f228b_1870x891.png) # 参数说明及示例 ## 入口参数 输入字符串:输入一串字符串,示例: `" as dasd dasf ad "` 截取标志 trim-截取两边 all-截取所有:设置截取格式,示例: `"trim"` ## 出口参数 返回字符串:返回截取空格后的字符串,示例: `__INNER__["result"]`