remove line breaks and white spaces [duplicate]
Possible Duplicate:
Replace Line Breaks in a String C#
hi I have an textarea
which anyone can enter text, where they can put line breaks inside the text area.
How can I remove the line breaks created by press开发者_开发问答ing the enter key? can either be in c# or javascript.
Try,
text.replace(/\s*/g," ")
This will collapse all contigious whitespace into a single space.
an alternative is to simply ban the use of the enter key in the textarea in the first place, which can be done with event handlers (onKeyPress, for example)
精彩评论