码迷,mamicode.com
首页 > 其他好文 > 详细

CString类Format()的用法?.xml

时间:2014-10-17 23:10:15      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   io   os   ar   使用   for   sp   

Format()?函数用于将数据转换为格式化的字符串输出
?
?
????举例如下;
?
?
??????
?????int???x???=???123;??
??CString???str;??
??str.Format("%d",???x);???????????????????//???123??
??str.Format("%6d",???x);?????????????????//???????123??
??str.Format("%06d",???x);???????????????//000123?????....不够6位??前面补0??这个比较实用
??str.Format("%x",???x);???????????????????//7b??
??str.Format("%X",???x);???????????????????//7B??
??str.Format("%04x",???x);???????????????//007b??
???
??float???x???=???123.456;??
??str.Format("%f",???x);???????????????????//???123.456??
??str.Format("%2.3f");???????????????????//???123.456??
??str.Format("%4.2f");???????????????????//?????123.45
?
?
?
CString???errormessage;??
??errormessage.Format("連接數據庫失敗!/r/n錯誤信息:%s",e.ErrorMessage());

本文使用?书画小说软件?发布,内容与软件无关,书画小说软件?更惬意的读、更舒心的写、更轻松的发布。

CString类Format()的用法?.xml

标签:style   http   color   io   os   ar   使用   for   sp   

原文地址:http://www.cnblogs.com/shuilan0066/p/4032201.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!