-1

I want to trim empty string from end of the string. For example; txtSearch value is 'test ' How to replace it 'test'?

<asp:TextBox runat="server" ID="txtSearch" onKeyDown="return search_onKeyDown(event);" onKeyUp="search_onKeyUp(event);"
baros
  • 241
  • 2
  • 7
  • 22
  • 1
    To explain the downvotes - did you do your research before asking? Trivial google search should answer this one. – John Dvorak May 22 '13 at 07:03

2 Answers2

1

You can use .trim() in jQuery.It will trim all the first and last spaces

.trim()

$.trim("    hello, how are you?    ");

OUTPUT: "hello, how are you?"

PSR
  • 39,804
  • 41
  • 111
  • 151
-1

You can use C# TrimEnd() function in code

Sergey Shabanov
  • 176
  • 2
  • 11