search

Home  >  Q&A  >  body text

c++ - c语言有原始字符串的表达方式,或者替代方案么?

类似于python中有语法可标识原始字符串 而非转移字符

print r'\n'
直接打印 \n

为了解决此问题:c语言中使用正则表达式,没有原始字符表达 很不方便.

或者有没有什么其他替代的方案,谢谢

PHP中文网PHP中文网2773 days ago493

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 14:39:02

    Write a preprocessor yourself.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 14:39:02

    It feels like it has nothing to do with regular expressions.

    c can completely meet your needs, just escape it.

    #include <stdio.h>
    int main() {
        printf("\n");
        return 0;
    }

    reply
    0
  • Cancelreply