c字符串&&c++string处理(字符、字符串、数字转换)

C++基础教程之string


string中方法
https://jingyan.baidu.com/article/a65957f437070d24e77f9b76.html
c++参考手册
http://www.cplusplus.com/reference/string/string/append/
string赋值方法
https://blog.csdn.net/qq_36409711/article/details/72625140
string清空方法
https://blog.csdn.net/u010821666/article/details/77934510/
string判空
https://blog.csdn.net/qq_28351609/article/details/84770537
string理解
https://blog.csdn.net/qq_31930499/article/details/80374310


c/c++数字与字符串的准换

整理:https://www.cnblogs.com/StLovaer/p/11398993.html

注意:append的参数可以是const *char,返回值是string,
当一些c函数不能用string作为参数,可以考虑利用append(参数看reference)

较全文章
https://www.cnblogs.com/johngu/p/7878029.html

string.c_str(在用C中,atoi等等,无string类型用的到)
https://www.cnblogs.com/newzol/p/8686076.html

tostring/stoi(数字转字符)
http://c.biancheng.net/view/1527.html
https://blog.csdn.net/w55100/article/details/79886788
https://blog.csdn.net/baidu_34884208/article/details/88342844

atoi
http://c.biancheng.net/cpp/html/125.html

strtol()、ltoa()与sprintf()—刷题必备
https://blog.csdn.net/hechao3225/article/details/54707990


分割(读入数据)

stringstream/ sprintf()/sscanf()
https://www.cnblogs.com/houchen/p/8984164.html
stringstream
https://blog.csdn.net/shs1992shs/article/details/83051298
https://www.cnblogs.com/liangf27/p/9356849.html(int 与 string直接转换)
sscanf详解
https://blog.csdn.net/pengnanzheng/article/details/81120890

strtok、strtok_s、strtok_r 字符串分割函数(C)
https://blog.csdn.net/hustfoxy/article/details/23473805
https://blog.csdn.net/ChillPolaris/article/details/79830812

scanf(“%s",)与gets()输入字符串的区别,以及与getchar()吸收回车键的搭配
https://blog.csdn.net/BBHHTT/article/details/75671653


**%s 与 %ls的区别 **
https://codeday.me/bug/20190217/660477.html
https://blog.csdn.net/lw02nju/article/details/4384175/

五、char——转———>string

#include <iostream>
#include <string>
using namespace std;
 
int main()
{
    char ch='x';
    string str="";//空字符串
    str.append(1,ch);//1表示向末尾添加字符的数量是1,即向末尾添加一个ch字符
    cout<<str<<endl; 
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值