请叫高手,c#中是否有类似于sprintf函数?谢谢 麻烦能写一个例子吗Console.Wirte()里面的string 格式是什么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Console.Wirte("我的变量是:{0}",变量) 你们误解我的意思了!!我要用sprintf输出到一个变量,不是输出到屏幕!!大哥!string test="我的变量是:{0}"Console.Wirte(test,"变量")不行! 你们误解我的意思了!!我要用sprintf输出到一个变量,不是输出到屏幕!!大哥!string test="我的变量是:{0}"Console.Wirte(test,"变量")test里的值还是"我的变量是:{0}"!! 用 String 类的 Format 静态方法: ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemStringClassFormatTopic.htm如:string str = String.Format("The sum of {0} and {1} is {2}",2,3,2+3);将创建字符串"The sum of 2 and 3 is 5"。 sql2008中调用扩展存储报错,有谁遇到过? winform 中DataGridBoolColumn 问题 httpwebrequest加了encoding返回异常咋回事? about outlook's font 哈希表 问两个新手基础问题 PDA的网站如何做用户屏幕尺寸的适配呀??? 请问在C#中如何实现使用右键菜单 新闻内容与我数据库里的任一条有80%的相似度,我就要把它过滤掉。 dropdownlist控件刷新问题! 如何使用C#打开office的word,excel文件? 引用和指针有和什么区别?
大哥!string test="我的变量是:{0}"
Console.Wirte(test,"变量")不行!
大哥!string test="我的变量是:{0}"
Console.Wirte(test,"变量")
test里的值还是"我的变量是:{0}"!!
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemStringClassFormatTopic.htm如:
string str = String.Format("The sum of {0} and {1} is {2}",2,3,2+3);
将创建字符串"The sum of 2 and 3 is 5"。