'Stripping "\" and "\n" from string
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\""
Solution 1:[1]
C++ code : ASCII code for '\n' and "" are 10 and 34
string str="";
for(int i=0;i<sample.length();i++){
if(sample[i]!=10 and sample[i]!=34){
str+=sample[i];
}
}
cout<< str;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mukesh Kushwaha |
