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
74、Salesforce的String的format方法的更多相关文章
- String的format方法
摘自:http://xiongzhenhui.iteye.com/blog/940416 http://blueram.iteye.com/blog/441683 一.常规类型.字符类型和数值类型的格 ...
- 字符串格式化-String类format方法
常规类型的格式化 String类的format()方法用于创建格式化的字符串以及连接多个字符串对象. format()方法有两种重载形式. 显示不同转换符实现不同数据类型到字符串的转换,如图所示: 测 ...
- Java中String类的format方法使用总结
可参考: http://www.cnblogs.com/fsjohnhuang/p/4094777.html http://kgd1120.iteye.com/blog/1293633 String类 ...
- VFP自定义函数StringFormat (仿.NET String.Format 方法)
VFP仿.NET String.Format 方法 将指定字符串中的每个{x}替换为相应值,并返回文本 *-- 调用格式 StringFormat("日期{2},字符{1}",&q ...
- php示例代码之类似于C#中的String.Format方法
php示例代码之类似于C#中的String.Format方法 原文来自于 http://stackoverflow.com/questions/1241177/c-string-format-equ ...
- Java中利用MessageFormat对象实现类似C# string.Format方法格式化
我们在写C#代码的时候常常会使用到string.Format("待格式化字符串{0},{1},....",参数1,参数2,...),来格式化字符串,特别是拼接字符的时候,这种方式使 ...
- java基础---->String和MessageFormat的format方法
这里介绍一下String和MessageFormat中的format方法的差异以及实现原理. String与MessageFormat的说明 一.两者的使用场景 String.format:for l ...
- java字符串格式化:String.format()方法的使用
转自:http://kgd1120.iteye.com/blog/1293633 常规类型的格式化 String类的format()方法用于创建格式化的字符串以及连接多个字符串对象.熟悉C语言的读者应 ...
- C# String.Format的格式限定符与Format方法将多个对象格式化一个字符串原理
Format方法将多个对象格式化成一个字符串Format方法解析格式字符串的原理: (1).格式字符串中的{0}会被替换成格式字符串之后的第一个参数,以此类推 (2).Format方法解析格式字符串时 ...
随机推荐
- 老牌激活工具 — Microsoft Toolkit 2.5.1正式版【转】
老牌激活工具 — Microsoft Toolkit 2.5.1正式版 Microsoft Toolkit 2.5.1是一个一键激活MS Office 及 win系统的工具.原理就是利用KMS来激活 ...
- selenium2-java 浏览器的三种弹窗处理
alert弹窗 confirm弹窗 prompt弹窗 点击确定 // 选取警告弹窗 Alert alert=driver.switchTo().alert(); ...
- cortable 使用方法
星期一到星期六,早上六点到晚上六点.每隔两个小时 执行语句 0 6-18/2 * * 1-6 commond
- Linux崩溃时启动脚本获取进程相关信息
编写test.cpp #include <stdlib.h> #include <stdio.h> #include <exception> #include &l ...
- docker调用yum时“"/usr/libexec/urlgrabber-ext-down" is not installed”
原因: 1 docker镜像为高版本的fedora30:latest镜像,yum本身已被dnf替代,但部分功能仍不完整: 如:yum-builddep SPECS/xxx.spec 解决办法: 1 安 ...
- this.$router.push相关的vue-router的导航方法
this.$router.push相关的vue-router的导航方法:https://blog.csdn.net/zeroyulong/article/details/80312750
- Python基础篇(is和==)
python基础篇(is,==,): 一.is和==的区别 1.id() 通过id()我们可以查看到一个变量表示的值在内存中的地址. s = 'alex' s = "alex" l ...
- centos7.3安装wordpress
一.安装并配置数据库 1.安装mariadb #yum install -y mariadb-server mariadb 2.启动数据库并设置开机自启#systemctl start mariadb ...
- js自增++与自减--运算符
/** * 自增(++)与自减(--)运算符 */ // 自增示例 var a = 1, c, d, e; console.log(`a++ = ${a++}`); // a++ = 1 consol ...
- 使用extract-text-webpack-plugin处理css文件路径问题
首先看到我们的文件夹目录如下: webpack.config.js //解析分离cssconst ExtractTextPlugin = require('extract-text-webpack-p ...