摘要: substr()函数用法:substr(起始位置,长度)#include#includeusing namespace std;main(){ string s("12345asdf"); string a=s.substr(0,4); //获得字符串s中 从第0位开始的长度为4的字符串 cout#includeusing namespace std;main(){ string str1, str2 = "War and Peace"; str1.assign( str2, 4, 3 ); //str2 字符串的第4个字符位置开始赋值给str1,长度为 阅读全文
posted @ 2013-04-08 20:11 Felix_F 阅读(272) 评论(0) 推荐(0)