使用C#的朋友都知道,string.Format();还是挺好用的,如:
string str1 = "杰卫,这里有{0}个苹果,和{1}个香蕉!{0}个苹果{3} 元,{1}个香蕉{4} 元,一共{2}钱";
string str2 = "Hei jave, there are {0} apples,and {1} banana! {2} dollar all together";
Console.WriteLine(string.Format(str1, 5, 10, 20, 7, 13));
Console.WriteLine(string.Format(str2, 5, 10, 20));
//输出:
杰卫,这里有5个苹果,和10个香蕉!5个苹果7 元,10个香蕉13 元,一共20钱
Hei jave, there are 5 apples,and 10 banana! 20 dollar all together
在as3中,String 类没有提供类似的方法,我们可以自己实现:
private function formate(str:String, ...args):String{
for(var i:int = 0; i
关注
打赏
热门博文
- 3D Assets (Textures & Model & Animations) & Game Design Ideas & DCC Tutorials & TA
- LearnGL - 学习笔记目录
- Unity - Timeline 知识汇总
- Unity Graphics - 知识点目录 - 停止翻译,因为发现官方有中文文档了
- Graphic资料
- Unity Lightmap&LightProbe局部动态加载(亲测2020以及以上版本官方修复了)
- Unity - 踩坑日志 - 低版本线性颜色空间渲染异常的 “BUG”
- Unity Shader - PBR 渲染 SP 导出的素材
- 什么是 3A 游戏?
- Photosohp - 实现 2D MetaBall、MetaFont