Removing various forms of line breaks

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?
 
P

Peter Rilling

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top