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

  • 相关阅读:
    codevs 4511 信息传递(NOIP2015 day1 T2)
    caption标签,为表格添加标题和摘要
    用css样式,为表格加入边框
    table标签,认识网页上的表格
    认识div在排版中的作用
    使用ol,添加图书销售排行榜
    使用ul添加列表
    使用<pre>标签为你的网页加入大段代码
    想加入一行代码吗?使用<code>标签
    <address>标签,为网页加入地址信息
  • 原文地址:https://www.cnblogs.com/weizhen/p/6383081.html
Copyright © 2011-2022 走看看