当前位置: 首页 > news >正文

天津网站排名方案威海优化联系电话

天津网站排名方案,威海优化联系电话,怎么查公司名称是否被注册商标,上海外滩1. RMBCAP函数 RMBCAP 函数可以将金额小写转换为人民币大写金额形式。 2. 函数用法 RMBCAP(数字) 3. 函数示例 如#xff0c;在财务结算、报销管理、对公付款等场景中#xff0c;可以利用 RMBCAP 函数将金额转换为大写#xff0c;避免被篡改产生的负面影响 4. 代码实战…1. RMBCAP函数 RMBCAP 函数可以将金额小写转换为人民币大写金额形式。 2. 函数用法 RMBCAP(数字) 3. 函数示例 如在财务结算、报销管理、对公付款等场景中可以利用 RMBCAP 函数将金额转换为大写避免被篡改产生的负面影响 4. 代码实战 首先我们在function包下创建text包在text包下创建RmbCapFunction类代码如下 package com.ql.util.express.self.combat.function.text;import com.ql.util.express.Operator; import com.ql.util.express.exception.QLException; import com.ql.util.express.self.combat.helper.RmbCapConverter;import java.math.BigDecimal;/*** 类描述: RMBCAP函数** author admin* version 1.0.0* date 2023/11/24 15:00*/ public class RmbCapFunction extends Operator {public RmbCapFunction(String name) {this.name name;}Overridepublic Object executeInner(Object[] list) throws Exception {String rst ;if (list.length 0) {throw new QLException(操作数异常);} else if (list.length ! 1) {throw new QLException(操作数个数异常);} else {//数字Object num list[0];BigDecimal numB new BigDecimal(num.toString());double numD numB.doubleValue();rst RmbCapConverter.convertToRmbCap(numD);}return rst;} } 在combat文件夹下创建工具包helper在helper包中创建RmbCapConverter类 package com.ql.util.express.self.combat.helper;import java.math.BigDecimal;/*** 类描述: RmbCapConverter工具类** author admin* version 1.0.0* date 2023/11/24 15:02*/ public class RmbCapConverter {private static final String[] RMB_UNIT {, 拾, 佰, 仟, 万, 拾, 佰, 仟, 亿,拾,佰,仟};private static final String[] RMB_DIGIT {零, 壹, 贰, 叁, 肆, 伍, 陆, 柒, 捌, 玖};public static String convertToRmbCap(double amount) {BigDecimal bd new BigDecimal(amount);String rmbCap ;// 判断金额正负if (bd.compareTo(BigDecimal.ZERO) 0) {rmbCap 负;bd bd.abs(); // 取绝对值}String rmbStr bd.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();int dotPos rmbStr.indexOf(.);String integerPart dotPos -1 ? rmbStr : rmbStr.substring(0, dotPos);String decimalPart dotPos -1 ? : rmbStr.substring(dotPos 1);rmbCap translateIntegerPart(integerPart);rmbCap translateDecimalPart(decimalPart);return rmbCap;}private static String translateIntegerPart(String integerPart) {// 移除整数部分的前导零integerPart integerPart.replaceFirst(^0, );if (integerPart.equals()) {return RMB_DIGIT[0];}StringBuilder rmbCap new StringBuilder();int digitCount integerPart.length();int unitIndex digitCount - 1;boolean zeroFlag false;for (int i 0; i digitCount; i) {int digit integerPart.charAt(i) - 0;if (digit 0) {zeroFlag true;} else {if (zeroFlag) {rmbCap.append(RMB_DIGIT[0]);}zeroFlag false;rmbCap.append(RMB_DIGIT[digit]).append(RMB_UNIT[unitIndex]);}unitIndex--;}return rmbCap.toString()元;}private static String translateDecimalPart(String decimalPart) {if (decimalPart.equals() || decimalPart.equals(00)) {return ;} else {int digit1 decimalPart.charAt(0) - 0;int digit2 decimalPart.charAt(1) - 0;StringBuilder rmbCap new StringBuilder();if (digit1 ! 0) {rmbCap.append(RMB_DIGIT[digit1]).append(角);}if (digit2 ! 0) {rmbCap.append(RMB_DIGIT[digit2]).append(分);}return rmbCap.toString();}} } 把RmbCapFunction类注册到公式函数入口类中代码如下 package com.ql.util.express.self.combat.ext;import com.ql.util.express.ExpressRunner; import com.ql.util.express.IExpressResourceLoader; import com.ql.util.express.parse.NodeTypeManager; import com.ql.util.express.self.combat.function.logic.*; import com.ql.util.express.self.combat.function.math.*; import com.ql.util.express.self.combat.function.text.*;/*** 类描述: 仿简道云公式函数实战入口类** author admin* version 1.0.0* date 2023/11/21 15:29*/ public class FormulaRunner extends ExpressRunner {public FormulaRunner() {super();}public FormulaRunner(boolean isPrecise, boolean isTrace) {super(isPrecise,isTrace);}public FormulaRunner(boolean isPrecise, boolean isStrace, NodeTypeManager nodeTypeManager) {super(isPrecise,isStrace,nodeTypeManager);}public FormulaRunner(boolean isPrecise, boolean isTrace, IExpressResourceLoader iExpressResourceLoader, NodeTypeManager nodeTypeManager) {super(isPrecise,isTrace,iExpressResourceLoader,nodeTypeManager);}Overridepublic void addSystemFunctions() {// ExpressRunner 的内部系统函数super.addSystemFunctions();// 扩展公式函数this.customFunction();}/**** 自定义公式函数*/public void customFunction() {// 逻辑公式函数this.addLogicFunction();// 数学公式函数this.addMathFunction();// 文本函数this.addTextFunction();}public void addTextFunction() {// CHAR函数this.addFunction(CHAR,new CharFunction(CHAR));// CONCATENATE函数this.addFunction(CONCATENATE,new ConcatenateFunction(CONCATENATE));// EXACT函数this.addFunction(EXACT,new ExactFunction(EXACT));// IP函数this.addFunction(IP,new IpFunction(IP));// ISEMPTY函数this.addFunction(ISEMPTY,new IsEmptyFunction(ISEMPTY));// JOIN函数this.addFunction(JOIN,new JoinFunction(JOIN));// LEFT函数this.addFunction(LEFT,new LeftFunction(LEFT));// LEN函数this.addFunction(LEN,new LenFunction(LEN));// LOWER函数this.addFunction(LOWER,new LowerFunction(LOWER));// MID函数this.addFunction(MID,new MidFunction(MID));// REPLACE函数this.addFunction(REPLACE,new ReplaceFunction(REPLACE));// REPT函数this.addFunction(REPT,new ReptFunction(REPT));// RIGHT函数this.addFunction(RIGHT,new RightFunction(RIGHT));// RMBCAP函数this.addFunction(RMBCAP,new RmbCapFunction(RMBCAP));}public void addLogicFunction() {// AND函数this.addFunction(AND,new AndFunction(AND));// IF函数this.addFunction(IF,new IfFunction(IF));// IFS函数this.addFunction(IFS,new IfsFunction(IFS));// XOR函数this.addFunction(XOR,new XorFunction(XOR));// TRUE函数this.addFunction(TRUE,new TrueFunction(TRUE));// FALSE函数this.addFunction(FALSE,new FalseFunction(FALSE));// NOT函数this.addFunction(NOT,new NotFunction(NOT));// OR函数this.addFunction(OR,new OrFunction(OR));}public void addMathFunction() {// ABS函数this.addFunction(ABS,new AbsFunction(ABS));// AVERAGE函数this.addFunction(AVERAGE,new AvgFunction(AVERAGE));// CEILING函数this.addFunction(CEILING,new CeilingFunction(CEILING));// RADIANS函数this.addFunction(RADIANS,new RadiansFunction(RADIANS));// COS函数this.addFunction(COS,new CosFunction(COS));// COT函数this.addFunction(COT,new CotFunction(COT));// COUNT函数this.addFunction(COUNT,new CountFunction(COUNT));// COUNTIF函数this.addFunction(COUNTIF,new CountIfFunction(COUNTIF));// FIXED函数this.addFunction(FIXED,new FixedFunction(FIXED));// FLOOR函数this.addFunction(FLOOR,new FloorFunction(FLOOR));// INT函数this.addFunction(INT,new IntFunction(INT));// LARGE函数this.addFunction(LARGE,new LargeFunction(LARGE));// LOG函数this.addFunction(LOG,new LogFunction(LOG));// MAX函数this.addFunction(MAX,new MaxFunction(MAX));// MIN函数this.addFunction(MIN,new MinFunction(MIN));// MOD函数this.addFunction(MOD,new ModFunction(MOD));// POWER函数this.addFunction(POWER,new PowerFunction(POWER));// PRODUCT函数this.addFunction(PRODUCT,new ProductFunction(PRODUCT));// RAND函数this.addFunction(RAND,new RandFunction(RAND));// ROUND函数this.addFunction(ROUND,new RoundFunction(ROUND));// SIN函数this.addFunction(SIN,new SinFunction(SIN));// SMALL函数this.addFunction(SMALL,new SmallFunction(SMALL));// SQRT函数this.addFunction(SQRT,new SqrtFunction(SQRT));// SUM函数this.addFunction(SUM,new SumFunction(SUM));// SUMIF函数this.addFunction(SUMIF,new SumIfFunction(SUMIF));// SUMIFS函数this.addFunction(SUMIFS,new SumIfsFunction(SUMIFS));// SUMPRODUCT函数this.addFunction(SUMPRODUCT,new SumProductFunction(SUMPRODUCT));// TAN函数this.addFunction(TAN,new TanFunction(TAN));} } 创建测试用例 package com.ql.util.express.self.combat;import com.ql.util.express.DefaultContext; import com.ql.util.express.self.combat.ext.FormulaRunner; import org.junit.Test; /*** 类描述: 实战测试类** author admin* version 1.0.0* date 2023/11/21 15:45*/ public class CombatTest {Testpublic void RMBCAP() throws Exception{FormulaRunner formulaRunner new FormulaRunner(true,true);// 创建上下文DefaultContextString, Object context new DefaultContext();String express RMBCAP(1234111111.56);Object object formulaRunner.execute(express, context, null, true, true);System.out.println(object);}} 运行结果
http://www.pierceye.com/news/281217/

相关文章:

  • 吉林省住房和城乡建设厅网站官网手机百度app免费下载
  • 微信开放平台网站应用营销网站建设的规则
  • 网站制作语言有哪些对接标准做好门户网站建设
  • asp 公司网站源码贵州省建设厅的网站
  • 企业网站备案资料样本自建网站要多少钱
  • 女生做网站推广常用的网站推广方法
  • 营销型网站建设公司哪家建设开封做网站公司汉狮
  • 烟台专业网站建设seo实战培训教程
  • 上海建设项目环保验收公示网站dw做网站首页长宽设置多少
  • 中山网站制作系统创意视差wordpress主题
  • 安康网站开发公司广州微网站建设哪家好
  • 网站建设企业官网源码被代运营骗了怎么追回
  • 网站服务器 重启用邮箱做网站
  • 网站建设修改建议书网站快速收录方法
  • 网站建设项目步骤网站空间可以换吗
  • 美食网站界面设计网页设计制作代码大全
  • 宁波网站建设托管网站正在建设维护中页面
  • 古色古香网站模板响应式布局网站
  • 网站建设制作设计开发福建网站开发文档撰写
  • 钢管公司网站建设国外平面设计欣赏网站
  • 网站建设如何销售济南专门做网站的公司
  • 2018年淘宝客网站怎么做iis网站建设中
  • 网站倒计时代码企业网站建设运营方案
  • 课程网站开发过程东莞外贸模板建站
  • asp.net 网站提速廊坊企业官网搭建
  • 网站开发全过程电商数据分析
  • 代理 指定网站 hostwordpress图片无限放大
  • 中材建设有限公司招标网站包装设计网课答案
  • python云服务器网站开发实例外贸小家电网站推广
  • 郑州做网站公司中天猫商城的商品来源