Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8733989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:45:22+00:00 2026-06-13T09:45:22+00:00

I’m looking for fast and efficent way to split code and prapare it for

  • 0

I’m looking for fast and efficent way to split code and prapare it for press. I’m working for coder magazine, and it’s always a huge problem to prepare code for press, ’cause space in one column is limited. Now I’m doing it manually and it is very tiresome. Let me give you an example. This is a code I’m working on right now (already formatted/spitted in my own style), it’s for Android:

private void GetFiles() {
  listBox1.Items.Clear();
  var storeFile = IsolatedStorageFile. 
    GetUserStoreForApplication();
  string fileString = System.IO.Path.GetFileName("*");
  string[] files = storeFile.GetFileNames("*");
  for (int i = 0; i < storeFile.GetFileNames("/" + 
      fileString).Length; i++) {
    String fileName = storeFile.GetFileNames(fileString)[i];
    String ext = fileName.Substring(fileName.Length - 3);
    if (ext == "png") listBox1.Items.Add(fileName);

}
}

Note that

var storeFile = IsolatedStorageFile. 
    GetUserStoreForApplication();

is one line. It’s just too long for press column, that’s why I split by the nearest logical break (here – point) and indent the second part of the line with 4 spaces (inline is always indented by 2 spaces). I know, it’s not the best way, it’s hard to understand. That’s why I’m looking an authoritative answer from the wide range of software developers. I have to work not only with C++ code, but with Assembler, JavaScript, Ruby and Python. The last one is a separate problem – it’s indent-dependive, so I have to be especially carefull with indents.

So, the question is: which is the best way to format code in limited space of the magazine? Which way do you prefer? Please, suggest your own ideas. Every answer is highly appreciated.

UPD: Here’s the way how it looks in magazine now: Current look. It may help you to uderstand the problem. Too long lines are splited by ‘\’ and the last part of line is indented. Not too obvious, isn’t it? =(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:45:23+00:00Added an answer on June 13, 2026 at 9:45 am

    Why don’t you simply use Eclipse built-in code formatter. You can easily configure the maxline length amongst other things. Then you simply use ctrl+shift+f to format according to your defined codestyle.

    Ah, I didn’t realize this wasn’t a specific Java question. The code you pasted here doesn’t compile and the editor refuses to format it. But if I use your screenshot it will, by default look like this (i changed max line length a bit tho):

    if (Input.GetKeyDown("space")) {
        Vector3 prosition = new Vector3(
            tranform.position.x,
            transform.position.y + 1,
            transform.position.z);
        }
        Instantiate(ProjectilePrefab, position,
                Quaternion.Identiy);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I've tracked down a weird MySQL problem to the two different ways I was
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.