剥离“\”和“\n”从字符串
我在变量中有以下代码。我想去掉“”和“\n”字符。我已经尝试过类似的事情
variable | replace('\\','')
,但它不起作用。有什么想法吗?
变量的完整内容:
"\"v=DKIM1; k=rsa;\n \"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzlKOKQ/tPSqdrxM3ANorroiZU4LqUwFVkFwLY82qepGVqmaCbv4T52GcPx3YJE/GNu55e2iuzARUS3eqPOsTKrqrTpcovS5h8QTGMxvyd+yXfosCZ84TlQ8knG8RQHG8Z8vmxgjgvY9k89TA3doRacSmEBeHNFOYiRtL5ZpdF45Wzpj19gz+bV4z2TmFE3dxPThTcicn/FMchL\"\n \"nfVj5LfUqK2x+HCvI8hCXGfUiD5zsTd5VKOVwpn2t1p/kOjaY6++RA19DDz+oEoCTBh2QS7pCmb65dshiR3lXKbkbLaj4bEw6IHPyaDiHauYAa/Ra61HEsYoEci7P4Jc28gEXxjwIDAQAB\""
I have the below code in a variable. I want to strip the "" and "\n" characters. I have tried things like
variable | replace('\\','')
but it does not work. Any ideas?
Full contents of variable:
"\"v=DKIM1; k=rsa;\n \"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzlKOKQ/tPSqdrxM3ANorroiZU4LqUwFVkFwLY82qepGVqmaCbv4T52GcPx3YJE/GNu55e2iuzARUS3eqPOsTKrqrTpcovS5h8QTGMxvyd+yXfosCZ84TlQ8knG8RQHG8Z8vmxgjgvY9k89TA3doRacSmEBeHNFOYiRtL5ZpdF45Wzpj19gz+bV4z2TmFE3dxPThTcicn/FMchL\"\n \"nfVj5LfUqK2x+HCvI8hCXGfUiD5zsTd5VKOVwpn2t1p/kOjaY6++RA19DDz+oEoCTBh2QS7pCmb65dshiR3lXKbkbLaj4bEw6IHPyaDiHauYAa/Ra61HEsYoEci7P4Jc28gEXxjwIDAQAB\""
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C++代码:
'\n' 和 "" 的 ASCII 代码分别是 10 和 34
C++ code :
ASCII code for '\n' and "" are 10 and 34