I want to only encode a substring in my string, here test
from String str = \"test"\
Is there a better way to do this than what I did below? Perhaps through an regEx?
var fullStr = "\"\\test\"\\";
char[] charsToTrim = { '\"', '\\'};
string result = fullStr.Trim(charsToTrim);
string StrEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(result));
string retStr = "\"\\" + StrEncoded + "\"\\";