zoukankan      html  css  js  c++  java
  • 54、salesforce学习笔记(一)

    Decimal priceDecimal = -4.50;
    System.debug('小数的绝对值为:'+priceDecimal.abs());
    
    System.debug('priceDecimal除以10小数点保留两位小数:'+ priceDecimal.divide(10,2));
    
    System.debug('将priceDecimal转换成Double类型'+priceDecimal.doubleValue());
    
    System.debug('Decimal转成String类型'+priceDecimal.format());
    
    System.debug('将Decimal转成Integer类型'+priceDecimal.intValue());
    
    System.debug('将Decimal转成Long类型'+priceDecimal.longValue());
    
    System.debug('priceDecimal平方值为:'+priceDecimal.pow(2));
    
    System.debug('priceDecimal数字总数为:'+priceDecimal.precision());
    
    System.debug('priceDecimal四舍五入Long类型值为:'+priceDecimal.round());
    
    System.debug('priceDeciaml的小数为2位'+priceDecimal.setScale(2));
    
    System.debug('移出priceDecimal小数点后的0以后的值为:'+priceDecimal.stripTrailingZeros());
    
    System.debug('不使用科学计数法转换成String类型'+priceDecimal.toPlainString());
    
    Long priceL = 12345;
    Double priceD = 123.456;
    String priceS = '12345';
    Decimal d1 = Decimal.valueOf(priceL);
    Decimal d2 = Decimal.valueOf(priceD);
    Decimal d3 = Decimal.valueOf(priceS);

    Double

    Double price = 34.5678;
    String doubleString = '3.89';
    System.debug('将字符串转换成Double'+Double.valueOf(doubleString));
    
    Long priceLong = price.round();
    System.debug('通过round方法将double转换成Long类型值为:'+priceLong);
    
    Integer priceInteger = price.intValue();
    System.debug('将double转换成Integer类型值为:'+priceInteger);
    
    Long priceLongByLongValue = price.longValue();
    System.debug('将double转换成Long类型值为:'+priceLongByLongValue);

  • 相关阅读:
    《神经网络论文精读》
    刻意练习
    马斯洛模型
    MRP执行计划列表(禁用)
    生产齐套分析
    BZOJ 3589: 动态树 树链剖分+线段树+树链的并
    CF1043F Make It One 容斥+dp+组合
    CF1073D Berland Fair 二分+线段树
    BZOJ 5084: hashit 后缀自动机(原理题)
    BZOJ 3991: [SDOI2015]寻宝游戏 树链的并+set
  • 原文地址:https://www.cnblogs.com/weizhen/p/6383081.html
Copyright © 2011-2022 走看看