多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 组件源码 ``` /** * <b>方法描述:</b> 字符串补齐 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-09-05 18:28:13 <br/> * * @param text * 入参|待补充字符串|{@link java.lang.String} * @param ch * 入参|补齐字符|{@link char} * @param len * 入参|补齐长度|{@link int} * @param left * 入参|是否左补齐|{@link boolean} * @param charset * 入参|目标字符集|{@link java.lang.String} * @param text * 出参|补齐字符串|{@link java.lang.String} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "字符串补齐", style = "判断型", type = "同步组件", comment = "字符串根据输入的字符,补齐位置补齐到指定长度", version = "1.0.0", deprecated = false, author = "huqiang", date = "2018-09-05 06:28:13") @InParams(param = { @Param(name = "charset", comment = "目标字符集", type = java.lang.String.class), @Param(name = "text", comment = "待补充字符串", type = java.lang.String.class), @Param(name = "ch", comment = "补齐字符", type = char.class), @Param(name = "len", comment = "补齐长度", type = int.class), @Param(name = "left", comment = "是否左补齐", type = boolean.class) }) @OutParams(param = { @Param(name = "text", comment = "补齐字符串", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_fillChar(String charset, String text, char ch, int len, boolean left) { try { return ResultBase.newSuccessResult(StringUtil.fillChar(charset, text, ch, len, left)); } catch (Exception e) { AppLog.error(e); } return ResultBase.newExceptionResult("TPTS1018", "参数错误,不能补齐"); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/3d/36/3d36cb3340b60319ec5cdbeda97d2007_1869x911.png) # 参数说明及示例 ## 入口参数 目标字符集:设置字符串的字符集编码,示例: `"utf-8"` 待补充字符串:字符串,示例: `"你好,世界hhhh"` 补齐字符:长度不够时填充的字符,示例: `'h'` 补齐长度:字符串的总字节数,示例: `20` 是否左补齐:是否从左边开始补充,示例: `true` ## 出口参数 补齐字符串:补齐完成后的字符串,示例: `__INNER__["result"]`