Remove Tabs using String.Replace [C#]

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
Given a string [line], I want to replace all Tabs in [Line] with spaces.
I know the general code [line = line.Replace(tabs, spaces)] but I seem to be lacking in the syntax department. How would you define (tabs) in the above code?

line = line.Replace( \t ,
 
Code:
string strWithTabs = "here is a string     with a tab";

// tab-character
char tab = \u0009;
String line = strWithTabs.Replace(tab.ToString(), "    ");
 
Back
Top