C++截取字符串子串实现

2015-08-13 0 743
C++截取字符串子串实现
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int substr(char *str,unsigned start, unsigned len)
{
    string temp;
    for(unsigned curr=start;curr<start+len;curr++){
        char tmp=str[curr];
        temp+=tmp;
    }
    cout<<temp<<endl;
   return 0;
}
int main(){
    char *test="wewesdsfadfdss";
    substr(test,3,3);
    return 0;
}

遇见资源网 c/c++ C++截取字符串子串实现 http://www.ox520.com/10276.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务