QString 和 std::string 转换
来源:互联网 发布:python curses 编辑:程序博客网 时间:2024/06/12 01:29
QString to std::string
One of the things you should remember when converting QString to std::string is the fact that QString is UTF-16 encoded while std::string... May have any encodings.
So the best would be either:
QString qs;// Either this if you use UTF-8 anywherestd::string utf8_text = qs.toUtf8().constData();// or this if you on Windows :-)std::string current_locale_text = qs.toLocal8Bit().constData();
The suggested (accepted) method may work if you specify codec.
std::string to QString
There's a QString function called fromUtf8 that takes a const char*:
QString str = QString::fromUtf8(content.c_str());
- QString 和 std::string 转换
- QString 转换 std::string
- std::string , Qstring和 const char * 的互相转换
- std::string ,QString和const char * 的互相转换
- QString 和std::string互转
- QString 和std::string互转
- QString 和std::string互转
- QString char std::string 相互转换
- QString与std::string相互转换
- QString与std::string的相互转换
- QString & std::string & char*之间的转换
- QString与std::string的相互转换
- QString与std::string的相互转换
- QByteArray QString std::string
- QString和String相互转换
- QString 与 char* 、std:string之间的转换
- 二进制std::string 与QString转换的问题
- Qt之std::string与QString之间的转换
- mysql设置主从库
- [原创]ONVIF WSDL IP地址
- eclipse + tomcat 重复加载 多工程 host
- 计算字符串的相似度
- 常见的编程风格总结
- QString 和 std::string 转换
- Oracle10g重建EM 报ORA-20001: SYSMAN already exists
- apple官方对block解释
- 热部署
- ActionContext
- Oracle 中的split 函数
- CKEditor的使用方法
- __stdcall,__cdecl,__fastcall的区别
- Android.mk编译APK范例