Removing various forms of line breaks

  • Thread starter Thread starter ChrisC
  • Start date Start date
C

ChrisC

Im having trouble removing line breaks from my c# string. Actually, im
having trouble getting .Trim() to work properly, as it seems to count
a string that has nowt but a break of some sort as not being empty.
To get trim to work properly im trying to axe out the line breaks
seperately. Ive got .replace("/r") and "/n" but still having problems
with some strings. Are there paragraph markers or something I should
be removing too? how do i specify to remove them?
 
Depending on the source of the string, the line breaks could be different
without having the actual content; it is hard to determine your exact
problem.



First, a string that has any bytes is not empty. Lines breaks are bytes,
therefore the string will of coarse not be empty.



Looks at the strings in the debugger watch window and you should see all
characters represented as something.


ChrisC said:
Im having trouble removing line breaks from my c# string. Actually, im
having trouble getting .Trim() to work properly, as it seems to count
a string that has nowt but a break of some sort as not being empty.
To get trim to work properly im trying to axe out the line breaks
seperately. Ive got .replace("/r") and "/n" but still having problems
with some strings. Are there paragraph markers or something I should
be removing too? how do i specify to remove them?
 
Back
Top