74、Salesforce的String的format方法

String placehodler = 'Hello {0} , {1} is cool!';
List<String> fillers = new String[]{'Jason','Apex'};
String formatted = String.format(placehodler,fillers);
System.assertEquals('Hello Jason , Apex is cool!',formatted);

结果如下所示

Anonymous execution was successful.

38.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
Execute Anonymous: String placehodler = 'Hello {0} , {1} is cool!';
Execute Anonymous: List<String> fillers = new String[]{'Jason','Apex'};
Execute Anonymous: String formatted = String.format(placehodler,fillers);
Execute Anonymous: System.assertEquals('Hello Jason , Apex is cool!',formatted);
13:50:33.21 (21991712)|USER_INFO|[EXTERNAL]|0056F00000652OT|weizhen.zhao@pactera.com|中国标准时间|GMT+08:00
13:50:33.21 (22007848)|EXECUTION_STARTED
13:50:33.21 (22013825)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
13:50:33.22 (22913817)|CUMULATIVE_LIMIT_USAGE
13:50:33.22 (22913817)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

13:50:33.22 (22913817)|CUMULATIVE_LIMIT_USAGE_END

13:50:33.21 (22953824)|CODE_UNIT_FINISHED|execute_anonymous_apex
13:50:33.21 (25331707)|EXECUTION_FINISHED

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值