Results 1 to 2 of 2
  1. #1
    andysh is offline Member
    Join Date
    Dec 2007
    Rep Power

    Default String Code Indentation

    If I have a string of a Java code imported from a file, how would i write the code so that it would indent the code properly.

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    I come from a C/C++ background, and what you're talking about is referred to as parsing or writing a parser, this was done with lex and yacc for C/C++. It's a bit of an advanced topic if you're willing to write your own. Otherwise, there's a good amount of them already written in Java. Find one that matches what you're looking for, or if you write your own - your grammar specification would be rules according to line indentation, for example.

Similar Threads

  1. Replies: 0
    Last Post: 11-20-2007, 05:59 PM
  2. Help with Switch string code
    By toby in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 07:00 AM
  3. how to set indentation to a text
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 07:42 PM
  4. Replies: 1
    Last Post: 08-03-2007, 11:52 AM
  5. Replies: 1
    Last Post: 04-26-2007, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts