【leetcode】替换空格

char* replaceSpace(char* s){
    char str[10000] ={0};
    int index = 0;
    while(*s)
    {
        if (*s == 0x20)
        {
            str[index++] = 0x25;
            str[index++] = 0x32;
            str[index++] = 0x30;
            s++;
            continue;
        }
        str[index++] = *s;        
        s++;
    }
    s = str;
    return s;
}

 

posted @ 2020-08-16 09:06  温暖了寂寞  阅读(95)  评论(0编辑  收藏  举报