由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Question about tab
相关主题
请教:parse CSV文件xml to PDF的package
JavaCC/SableCC/otherCC ?Do you guys use lex to parsing input?
Java XML parser的问题[ZT] choose your java xml parser
Java HTMLEditorKit 中取得html的text?java and javascript 问题请教,有包子
[转载] a question on XML parser用java访问数据库
Java.Net初学: 我的简单问题, 寻求简单方案hibernate高手求助
can someone recommend an html parser lib?Re: [转载] Re: why do u use XML?
关于Runtime.getRuntime().exec的问题Re: (I mean in java)Re: Help! Anyone have the experience extracting te
相关话题的讨论汇总
话题: tab话题: length话题: column话题: question话题: file
进入Java版参与讨论
1 (共1页)
j******r
发帖数: 201
1
The length of a tab can be 2, 4 or 8.
For a string read from a file: "\t\t\t", how could we know what
the length of each '\t' is?
T***B
发帖数: 137
2
length of '\t' only depends on the editor/terminal you use to display it.
not sure, though.

【在 j******r 的大作中提到】
: The length of a tab can be 2, 4 or 8.
: For a string read from a file: "\t\t\t", how could we know what
: the length of each '\t' is?

o**v
发帖数: 1662
3
u r right 【 在 TFIIB (小明) 的大作中提到: 】
j******r
发帖数: 201
4
actually my question is about parsing.
you can get the line and column number from the parser,
but you can not use subString to get the corresponding strings
because if these are tabs, the column number is not exactly the
position of the character in the string
for example:
"\t\tx=int;"
the column for x could be 8 or 4. but you should use subString(3,4?) to get "x",
but not (8,.)or (4,.).

【在 o**v 的大作中提到】
: u r right 【 在 TFIIB (小明) 的大作中提到: 】
T***B
发帖数: 137
5
how do you get column number? you mean column number for '\t\t' is
something like 8? that's weird.

"x",
it.

【在 j******r 的大作中提到】
: actually my question is about parsing.
: you can get the line and column number from the parser,
: but you can not use subString to get the corresponding strings
: because if these are tabs, the column number is not exactly the
: position of the character in the string
: for example:
: "\t\tx=int;"
: the column for x could be 8 or 4. but you should use subString(3,4?) to get "x",
: but not (8,.)or (4,.).

j******r
发帖数: 201
6
yes
if you have a string "\t\tx", and the length of tab is 4, the parser
i am using (javacc) will tell me the column number of 'x' is 8, not 3.
And the editor will show the column is 8 too.
Anyway, if I want to read a file, and display it in another terminal.
And I want the display is exactly as it is in the original one, i still need
to know the length of each '\t'.

【在 T***B 的大作中提到】
: how do you get column number? you mean column number for '\t\t' is
: something like 8? that's weird.
:
: "x",
: it.

m******t
发帖数: 2416
7
\t by itself does not carry a definitive width, it's up to
whoever reads the file to interpret it - that's actually
*the whole point* of having tabs. 8-)

【在 j******r 的大作中提到】
: yes
: if you have a string "\t\tx", and the length of tab is 4, the parser
: i am using (javacc) will tell me the column number of 'x' is 8, not 3.
: And the editor will show the column is 8 too.
: Anyway, if I want to read a file, and display it in another terminal.
: And I want the display is exactly as it is in the original one, i still need
: to know the length of each '\t'.

j******r
发帖数: 201
8
So there is no way to show the file exactly the same as in any other terminal?
coz just from the file, you have no way to know the length of the tab.

【在 m******t 的大作中提到】
: \t by itself does not carry a definitive width, it's up to
: whoever reads the file to interpret it - that's actually
: *the whole point* of having tabs. 8-)

c****r
发帖数: 185
9
Yes. So you should always avoid using the character tab.
Many editors have the option of replacing tab with spaces,
i.e., when you type the tab key, the editor inserts spaces instead
of the tab character.

terminal?
need

【在 j******r 的大作中提到】
: So there is no way to show the file exactly the same as in any other terminal?
: coz just from the file, you have no way to know the length of the tab.

e***g
发帖数: 158
10
death to tabs

【在 c****r 的大作中提到】
: Yes. So you should always avoid using the character tab.
: Many editors have the option of replacing tab with spaces,
: i.e., when you type the tab key, the editor inserts spaces instead
: of the tab character.
:
: terminal?
: need

T***B
发帖数: 137
11
there is a utility 'expand' in unix which can replace tabs in your
files to spaces. don't know if it is useful for you.
1 (共1页)
进入Java版参与讨论
相关主题
Re: (I mean in java)Re: Help! Anyone have the experience extracting te[转载] a question on XML parser
Configuration File reading.. xml?Java.Net初学: 我的简单问题, 寻求简单方案
How to find function pointers in Java?can someone recommend an html parser lib?
a simple parser for config files...关于Runtime.getRuntime().exec的问题
请教:parse CSV文件xml to PDF的package
JavaCC/SableCC/otherCC ?Do you guys use lex to parsing input?
Java XML parser的问题[ZT] choose your java xml parser
Java HTMLEditorKit 中取得html的text?java and javascript 问题请教,有包子
相关话题的讨论汇总
话题: tab话题: length话题: column话题: question话题: file