我需要用 C 编写凯撒密码,所以我正在一步步地理解我正在做的一切。
我需要处理特殊字符 示例:如果用户输入
“这是似曾相识的感觉!” 它会将其转换为 “这是似曾相识”
是否有 C 函数能够执行此操作,而不用手动为 ASCII 代码中的每个特殊字符执行此操作?
这是我要避免的:
case -85 :
case -86 :
case -87 :
case -88 :
*p = 'e';
最佳答案
Is there a C function capable of doing this instead of doing it by hand for each special char in ASCII code ?
Iconv当您选择 ASCII//TRANSLIT
作为目标编码时,将会执行您想要的操作。
关于C : Converting all special char to the equivalent (é => e),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4071613/