Share via


Specifying a Tab as a char

Question

Friday, May 1, 2009 7:20 PM

When I convert a .csv to a .txt file, there is continuous white space between each value on the same line. This is obviously a tab, and when copied into the find and replace appears as a small square. Is there anyway I can specify this as one of my separators when using the corresponding method from a TextWriter object?

Basically, how do I specify a tab as a char......please, of course.

All replies (9)

Friday, May 1, 2009 7:23 PM âś…Answered | 1 vote

See
http://www.asciitable.com/

Convert.ToChar(9)John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com


Friday, May 1, 2009 7:23 PM

Excellent. Appreciate the riposte!!!


Friday, May 1, 2009 7:24 PM

"\t" is a tab character. 

Escape Sequences

David Morton - http://blog.davemorton.net/


Friday, May 1, 2009 7:24 PM

I need to specify it as a charcter to split() the values from a FileStream.


Friday, May 1, 2009 7:25 PM | 1 vote

http://ascii.cl/

Tab = 9Mark the best replies as answers. "Fooling computers since 1971."


Friday, May 1, 2009 7:28 PM

riposte, good word, haven't heard that in a whileJohn Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com


Friday, May 1, 2009 7:29 PM

That's what you get for being nice and helping others.


Friday, July 13, 2012 5:24 PM

While many answers here work, i found the easiest way to be

"\t"[0]

as in

string[] strings = incomingStr.Split("\t"[0]);

Thursday, August 2, 2012 7:49 PM

While many answers here work, i found the easiest way to be

"\t"[0]

as in

string[] strings = incomingStr.Split("\t"[0]);

Note that you can define the char directly:

char c = '\t';

string[] strings = in.Split('\t');

There is no need to create a string then extract the first character from the string.

Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".