c# - replace whitespaces from string -
when phone call
string t = tmp.replace(@"\n", "").replace(@"\t", "");
where tmp
string-literal containing sth. '\n\t\t\t\t\tmirdochlatte'
(consider single-quotes part of string) result-string t
remains unchanged.
where miss delete whitespaces input?
btw.: hence actual string may or may not contain valid spaces searching tabs , new-lines.
you mixing literals , escaped characters. @"\n"
in fact is, literal: \n
, not line end expected.
try removing verbatim operator @
:
string t = tmp.replace("\n", "").replace("\t", "");
i suggest remove \r
too, since windows line ends have both \r
, \n
.
c#
No comments:
Post a Comment