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);

  • 相关阅读:
    个人总结
    4号团队-团队任务3:每日立会(2018-12-07)
    4号团队-团队任务3:每日立会(2018-12-06)
    4号团队-团队任务3:每日立会(2018-12-05)
    团队任务3
    课后作业2
    课后作业1
    相识两年的自我介绍
    Android模拟器
    用户
  • 原文地址:https://www.cnblogs.com/weizhen/p/6383081.html
Copyright © 2011-2022 走看看