字符串
来源:互联网 发布:网络流行aq是什么意思 编辑:程序博客网 时间:2024/06/03 17:26
在一些网站上做了一些练习题,发现自己对于字符串还有很大的欠缺,从头恶补。
一些零碎的知识点
1.字符串的长度,
c++:
string str;
c++中提供的有求字符串长度的函数,使用str.size()获取字符串的长度
不可以直接使用strlen(str)来求,因为strlen是c语言中的求长度的,它 要求的变量类型是char *的,如果硬要使用strlen可以使用std::string的c_str接口,
使用方法如下:
string str;cin>>str;
int i = str.size();
cout<<"str size is:"<<i<<endl;
i = strlen(st.c_str());
cout<<"str size is:"<<i<<endl;
0 0
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 字符串
- 工作之后十不要
- CF761 C. Dasha and Password (DP)
- DOM节点层次(一)
- C9-1 数组求和
- MySql binlog
- 字符串
- C9-2 折半查找
- ServletConfig和ServletContext接口
- Codeforces 761C DaSha and Password 暴力
- 孪生素数问题
- Leetcode 12. Integer to Roman
- Mysql备份与恢复
- mybatis缓存配置
- Codeforces Round #343 (Div. 2) C