aspose file tools*
The moose likes Ranch Office and the fly likes How do you put tabs in java codes in these forums? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "How do you put tabs in java codes in these forums?" Watch "How do you put tabs in java codes in these forums?" New topic
Author

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

Supun Lakshan Dissanayake
Ranch Hand

Joined: Oct 26, 2012
Posts: 131

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?


Are you better than me? Then please show me my mistakes..
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3436
    
  47

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

Joined: Oct 26, 2012
Posts: 131

to do it you are using text editor and simply do copy paste.
Am i right?

Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3436
    
  47

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

Joined: Oct 26, 2012
Posts: 131

Ok Thanks!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

XML entities work; you can type "& # 9 ;" (with spaces removed) to indicate a tab -- that's what I did here:




[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you put tabs in java codes in these forums?
 
Similar Threads
Auto tab event
JTabbedPane remove exception
safari browser issue
Where to put jquery scripts when using ajax enabled tabs?
add images and text in rich:tab header