Reputation: 10552
Hey all I currently am getting this response back from when I am calling a API call to get user information:
This is AFTER it try's to do the takeOutSpaces function which looks like this:
public string takeOutSpaces(string data)
{
string result = data;
char cr = (char)13;
char lf = (char)10;
char tab = (char)9;
result = result.Replace("\\r", cr.ToString());
result = result.Replace("\\n", lf.ToString());
result = result.Replace("\\t", tab.ToString());
return result;
}
So I'm not sure how to go about using something else to try to get rid of all those /n and /t's.
Upvotes: 0
Views: 65
Reputation: 10552
Modifying the takeOutSpaces function make it work:
public string takeOutSpaces(string data)
{
string result = data;
result = result.Replace("\r", "");
result = result.Replace("\n", "");
result = result.Replace("\t", "");
return result;
}
Upvotes: 0
Reputation: 113342
Your takeOutSpaces
is looking for actual instances of \r
etc. (which would appear as \\r
in debug view) and replacing it with a carriage return (which would appear as \r
in the debug view).
To remove those spaces you want to actually replace the whitespace, though it's probably not worth doing since it's more readable (outside of debug view) with it in, and any JSON parser should be fine with it.
Upvotes: 2