Share via


Remove tab from the string

Question

Monday, October 18, 2010 11:53 PM

Hello,

How to remove tab from the string?

All replies (4)

Monday, October 18, 2010 11:57 PM âś…Answered

You can replace \t from string.

String str = "Your String".Replace("\t", "yourcharacter");
String str = "Your String".Replace("\t", "");

Monday, October 18, 2010 11:58 PM

hi,

 refer below code

** String s = "abcd\tabc";
   s = s.Replace("\t", string.Empty);**


Tuesday, October 19, 2010 12:45 AM

this is a easy method to understand.. try it..

string yoursentencewithouttabs= yoursentencewithTabs.Replace("\t", "");


Tuesday, October 19, 2010 3:17 AM

hi

the best way to deal with tabs and spaces in string is trim function

use ltrim to remove leading tabs and space.

use rtrim to remove trailing tabs and spaces.

PLEASE MARK AS ANSWER.