I want to implement a text drawing function. But I am not sure how Show I have come up with the following algorithm: a) Each Example:
Should print:
Where: 1.Number 2. Does anyone know the standard algorithm? Thanks in advance. asked Oct 26, 2012 at 21:28
Chao ZhangChao Zhang 1,4162 gold badges14 silver badges25 bronze badges 5 A tab character should advance to the next tab stop. Historically tab stops were every 8th character, although smaller values are in common use today and most editors can be configured. I would expect your output to look like the following:
The algorithm is to start a column count at zero, then increment it for each character output. When you get to a tab, output answered Oct 26, 2012 at 21:32
Mark RansomMark Ransom 290k40 gold badges384 silver badges607 bronze badges 16 Imagine a ruler with tab stops every 8 spaces. A tab character will align text to the next tab stop.
To calculate where the next tab stop is, take the current
The In a text editor you may configure tab stops to smaller intervals, like every 4 spaces. If you're simulating what tabs look like at a terminal you should stick with 8 spaces per tab. answered Oct 26, 2012 at 21:33
John KugelmanJohn Kugelman 336k66 gold badges509 silver badges559 bronze badges 3 A Tab character shifts over to the next tab stop. By default, there is one every 8 spaces. But in most shells you can easily edit it to be whatever number of spaces you want (profile preferences in linux, set tabstop in vim). answered Oct 26, 2012 at 21:35
WhyrusleepingWhyrusleeping 8392 gold badges8 silver badges20 bronze badges This doesn't necessarily apply to the article, but In the old days of typewriters and fixed-width fonts, a tab was 5 spaces, because five characters was half an inch. That's pretty irrelevant now, though. posted 19 years ago
In
http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html says that tabs must be 8 spaces. But I remember that tabs is 4 spaces from one training course. I am confused. Rome was not built in a day.
Sheriff Posts: 9109 posted 19 years ago
Generally, you indent code 4
spaces e.g. JavaBeginnersFaq Mikey Chen Greenhorn Posts: 29 posted 19 years ago
Thanks! Rome was not built in a day. posted 19 years ago
Tabs are to be avoided at all costs. Since different editors treat tabs differently. Always use spaces to indent
your code. (If you are just working my yourself this isn't as important.) Please ignore post, I have no idea what I am talking about. mister krabs Posts: 13974 posted 19 years ago
Many editors have an option to insert spaces when using the tab key. You should always have that turned on. author Posts: 9046 posted 19 years ago
Sun
sez: each indent should be four spaces from the last level, and tabs should be eight spaces. So your first indent has to be four spaces, your second indent can be either eight spaces or a tab. The third can be 12 spaces or a tab and four spaces, and so on... Spot false dilemmas now, ask me how! posted 19 years ago
In the old and moldy days, all tabs were 8 spaces. Then some editors said you could specify how many spaces equaled a tab. So many geeks went with "4", that a lot of editors started making that the default. In the mean
time, lots of programs stubbornly insist on 8! posted 19 years ago
Indents are not Tabs and Tabs are not Indents. Is a tab 4 or 8 spaces?The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).
Is tab always 4 spaces?Sets the distance in spaces between tab stops. The default is four spaces.
How many spaces are there in tab?Indentation: tabs vs spaces
Java: 4 spaces, tabs must be set at 8 spaces.
How much space a tab key is?Common default tab widths are four spaces (in a monospaced text document), or half an inch (in a word processor). If formatting marks are enabled in your document editor, the tab character is often displayed as an arrow. The Tab key is located to the left of the Q key and above the Caps Lock key on keyboards.
|