string

xiaoxiao2021-02-28  47

c++中 string 用于字符串的处理

// string str("sssss");// 输出sssss string s="hello" ;// 输出hello //string s(str);//将str中的字符串 保存到s中 //string s(10,'c'); 将10个字符'c' 保存到s中 // char cs[]="12345"; string s(cs,3);//复制字符串cs的前3个字符到s当中 // string s="asac"; string s(s8,2);//从s2的第二个字符开始拷贝,不能超过s2的size  //string s10="qweqweqweq" string s11(s10,3,4);//s4是s3从下标3开始4个字符的拷贝,超过s3.size出现未定义
转载请注明原文地址: https://www.6miu.com/read-2622615.html

最新回复(0)