473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

how to work with tab-delimited files?

When you're using tabs to separate values in a text file, what do you do
in the case where pressing the tab key doesn't really advance the cursor
a full tab space (but instead just one or two spaces) because that's
where the next tab stop is?

Example:

Joe Smith
John Salerno

So the second entry has a full tab space between the names, but the
first doesn't, despite the fact that the tab key was pressed. So in this
situation, when the file is being read, is that single space still
determined to be a tab, or do you have to press tab twice to put a full
tab between the names?

Thanks.
May 23 '06 #1
3 1316
Hmm,
check your editor to see if it has an option to display non-printable
characters, or see if you can search for tabs in its find utility.

If you find that your editor has the ability to insert spaces instead
of tabs then turn it off.

Thats all that comes to mind...
- Pad.

May 23 '06 #2
> So in this situation, when the file is being read, is that
single space still determined to be a tab, or do you have to
press tab twice to put a full tab between the names?


If there is a literal tab in the file, it will come in (to your
code) as a real tab.

Your editor may have settings you can tweak to make it a little
more apparent. Vim (my preferred poison) allows you to

:set list

to see representations the literal tabs in your file. To turn it
off, do

:set nolist

You can also tweak your tabstops:

:set ts=12

(or whatever number/size accomodates your widest columns) which
would make a single tab character expand to your desired size.
This should help line matters up visually a little better.

Alternatively, with vim you can highlight the tabs to make them
stand out a bit more:

:match ErrorMsg /\t/

(or you can use another color instead of the ErrorMsg color...if
you hit <tab> after typing ":match ", it will successively show
you alternatives, or you can use ctrl+D to show a number of them)

Just a few ideas with a vim spin. Other quality editors should
support similar functionality.

-tkc

May 23 '06 #3
Tim Chase wrote:
So in this situation, when the file is being read, is that
single space still determined to be a tab, or do you have to
press tab twice to put a full tab between the names?


If there is a literal tab in the file, it will come in (to your code) as
a real tab.


Yeah, after viewing the unprintable characters, I see that no matter
what the spacing, there is a tab character between the values. I guess
what might be confusing me is the difference between Tab Stop Value and
Indent Spaces in my editor.
May 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mark | last post by:
Hi - could anyone please tell me why this line: <td width="116" height="22" nowrap id="toptSearch" class="mtTabOnTop" onClick="changeLoc('fixit_proceduresresultstick.asp','search')">Search <img...
2
by: Darryl Kerkeslager | last post by:
It seems that the only way to make themed AND classic Windows GUIs look okay with tab controls and subforms, due to the color issue, is to place a one page-no button tab control on each subform...
2
by: melanieab | last post by:
Hi, Just checking to see if there's anything I can possibly do to allow for the recognition of the Tab key being pressed. On the KeyDown event I've tried: if (e.KeyCode == Keys.Tab), if...
3
by: zayyaz | last post by:
I have created a protected worksheet that allows the user to input data into certain cells of the worksheet. They can alter the whole worksheet through some command buttons that I have created. The...
1
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.