• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you put tabs in java codes in these forums?

 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
How do you put tabs in java codes in these forums?
I am currently doing it as follows.
write java code in text editor i.e.Notepad++.
Replace tab with 4 spaces.

is there any other easier way to do it?

 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it is necessary to replace them at all. All you need to do is to use the code tag. The following matrix contains tabs as separators:

The tab size in code tags is apparently 4. If you use the same tab size in your project, the result in codetags should look the same as in your editor. With different sizes the indenting will be broken, obviously.
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to do it you are using text editor and simply do copy paste.
Am i right?

 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I almost always write the code to post here in an IDE, to make sure it compiles and works as I expect. When I post a code as part of asking a question, then again the code usually comes from the IDE, so that I know it compiles and does what I ask about; doing otherwise risks wasting other members' time. So it is copy-paste job indeed.

If the code to post is really small, I sometimes do write it right there in the code tag, but then I just use spaces for indenting, no tabs. In any case I don't know how to enter tabs directly into the editor when posting on the Ranch (or any other site, actually).
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Thanks!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML entities work; you can type "& # 9 ;" (with spaces removed) to indicate a tab -- that's what I did here:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic