Fun(char str){char p = str;char arr[20];while (p != ‘\0‘){if (p == ‘ ‘){strcpy(arr, p + 1);p = ‘%‘;(p + 1) = ‘2‘;*(p + 2) = ‘0‘;strcpy(p + 3, arr);p = p + 3;continue;}p++;}}
写一个函数,将字符串中空格替换为%20。
原文:https://blog.51cto.com/14239789/2429505