C语言字符串去除前导零:将"0000000003001.06"修改为"3001.06"
#include <stdio.h>\n#include <string.h>\n\nint main() {\n char str[] = "0000000003001.06";\n char output[20];\n\n int i = 0;\n while (str[i] == '0') {\n i++;\n }\n\n strcpy(output, &str[i]);\n printf("%s\n", output);\n\n return 0;\n}
原文地址: https://www.cveoy.top/t/topic/pFa9 著作权归作者所有。请勿转载和采集!