VC中数字与字符串转换方法

u     字符串转数字

 

l         1CRT函数

 

 

ASCII

UNICODE

TCHAR

VS2005

int

atoi

_wtoi

_tstoi,_ttoi

_atoi_l,_wtoi_l

long

atol

_wtol

_tstoi,_ttoi

_atoi_l,_wtoi_l

__int64

_atoi64

_wtoi64

_tstoi64,_ttoi64

_atoi64_l,_wtoi64_l

float

 

 

 

_atoflt,_atoflt_l

double

atof

_wtof

_tstof,_ttof

_atof_l,_wtof_l,_atodbl,_atodbl_l

long double

 

 

 

_atoldbl,_atoldbl_l

 

l         2.使用sscanf

 

l         3.Windows SDK<shlwapi.h>StrToInt

 

l         4.MFC/ATLCString::Format

 

u     数字转字符串

l         1CRT函数

 

 

ASCII

UNICODE

TCHAR

VS2005

int

Itoa,_itoa

_itow

_itot

long

Ltoa,_ltoa

_ltow

_ltot

__int64

_i64toa

_i64tow

_i64tot

double

Gcvt,_gcvt,_ecvt,_fcvt

_wtof

_tstof,ttof

_gcvt_s,_ecvt_s,_fcvt_s

l         2.使用sprintf

 

l         3.<strsafe.h>StringCbPrintf

u     通用相互转换方法

l         C++流方式:stringstream 

l         2.boost库:boost:: lexical_cast

摘自MSDNData-Conversion Routines

Routine

Use

atof, _atof_l, _wtof, _wtof_l

Convert string to float

atoi, _atoi_l, _wtoi, _wtoi_l

Convert string to int

_atoi64, _atoi64_l, _wtoi64, _wtoi64_l

Convert string to __int64

atol, _atol_l, _wtol, _wtol_l

Convert string to long

_ecvt, _ecvt_s

Convert double to string of specified length

_fcvt, _fcvt_s

Convert double to string with specified number of digits following decimal point

_gcvt, _gcvt_s

Convert double number to string; store string in buffer

_itoa, _itow, _itoa_s, _itow_s, _i64tow_s

Convert int to string

_i64toa, _ui64toa, _i64tow, _ui64tow, _i64toa_s, _ui64toa_s, _ui64tow_s

Convert __int64 to string

_ltoa, _ltow, _ltoa_s, _ltow_s

Convert long to string

strtod, _strtod_l, wcstod, _wcstod_l

Convert string to double

strtol, wcstol, _strtol_l, _wcstol_l

Convert string to long integer

strtoul, _strtoul_l, wcstoul, _wcstoul_l

Convert string to unsigned long integer

_ultoa, _ultow, _ultoa_s, _ultow_s

Convert unsigned long to string

atof, _atof_l, _wtof, _wtof_l

Convert wide-character string to a double

atoi, _atoi_l, _wtoi, _wtoi_l

Convert wide-character string to int

_atoi64, _atoi64_l, _wtoi64, _wtoi64_l

Convert wide-character string to __int64

atol, _atol_l, _wtol, _wtol_l

Convert wide-character string to long

原帖:http://www.cppblog.com/tbyxyz/articles/str2num.html

VC中数字与字符串转换方法相关推荐

  1. executequery方法_【接口测试】soapui中数字、字符串、日期时间、数据库连接参数化的设置方法...

    先回顾下前几篇soapui工具操作文章: 在soapui里面使用groovy脚本生成测试报告的方法 在soapui里面用groovy传递cookie身份信息的方法 soapui中进行接口响应数据的关联 ...

  2. C++中数字与字符串之间的转换 scanf string总结(复习必读)

    1 string的scanf读入操作 C++里面控制台输入直接使用cin操作就可以了:或者getline(istringstream,string); 字符和数字加减就是字符的ASCII码和数字直接加 ...

  3. Go中数字转换字符串的正确姿势

    在许多语言中,你可以轻松地将任何数据类型转换为字符串,只需将其与字符串连接,或者使用类型转换表达式即可.但是,如果你在Go中尝试执行似乎很明显的操作(例如将int转换为字符串),你不太可能获得预期的效 ...

  4. c语言中数字与字符串的转换

    1.itoa  在linux下没有itoa这个函数        原型:char  *itoa(int   value,char   *string,int   radix)           用法 ...

  5. Python中数字和字符串之间的转换

    数字转为字符串 这个相对比较简单 我们可以使用Python中的str函数直接转换 例如将123转换为'123' print(str(123)) 或者使用格式化 print('%s' %123) 字符串 ...

  6. C++中数字与字符串之间的转换

    1.字符串数字之间的转换 (1)string --> char *    string str("OK");    char * p = str.c_str(); (2)ch ...

  7. C++中数字和字符串的转换

    1.字符串数字之间的转换 (1)string --> char *    string str("OK");    char * p = str.c_str(); (2)ch ...

  8. 详说vC++中 string之万能转换方法

    C ++提供的由C++字符串得到对应的C_string的方法是使用data().c_str()和copy(),其中, data()以字符数组的形式返回字符串内容,但并不添加'\0'. c_str()返 ...

  9. C++中数字和字符串类型的转换

    // 编译环境: VS2013,C++11#include "stdafx.h" #include <iostream> #include <string> ...

最新文章

  1. Python爬虫爬取部分学校的新闻标题、时间、对应的新闻链接
  2. php不同洁面使用json_PHP针对JSON操作实例分析
  3. 政企上云正当时,华为云12.12大促助力中小企业数字转型升级
  4. Excel导入导出组件的设计
  5. 开源项目管理系统:ProjectForge
  6. pc套件 无法连接pc CDC Comms Interface
  7. mysql数据库repair_MySQL数据库中的REPAIRTABLE语法介绍
  8. GTC '19 经典回顾 | 如何编排和创造二次元中的舞蹈?
  9. 走进小程序【十一】微信小程序【使用Echarts 和 腾讯地图】
  10. Pytho读取Xml文件
  11. 实操演示 | 如何将示波器波形保存到U盘
  12. 22.【实战】车辆统计
  13. bootstrap 获取表格修改的结果_BootStrap实现带有增删改查功能的表格(DEMO详解)
  14. SIGIR论文写作技巧
  15. 玩手机惹怒丈夫 男子用菜刀砍死怀孕8个月妻子
  16. word 标尺快捷键
  17. Android上好看的倒数日APP,Hurry:颜值超高的倒数日 App,让 Android 手机桌面好看 2 倍 #Android...
  18. rss源_如何在Windows桌面上显示RSS源
  19. 信用百度公司商标信息爬取
  20. 捷信达集团办设置(windows7 或win 8.1)

热门文章

  1. 使用NavigationUI更新UI组件
  2. 你以为AlphaGo只是下围棋厉害?不,它还能用来优化金融交易策略参数
  3. Gradle系列(三):项目实践
  4. elasticsearc之mapping的介绍
  5. 乔恩与加菲猫引发的思考
  6. Linux基础知识--2.Linux的文件系统和bash的基础特性(1)
  7. Linux下Bluez的编程实现
  8. in作为介词的用法_英语中in/on/at/to/from/by/with/for/about/after/before的用法
  9. Docker部署Elasticsearch集群
  10. linux的spio在服务器间,scp 将数据从一台linux服务器复制到另一台linux服务器