Results 1 to 9 of 9

Thread: Removing extra whitespace

  1. #1

    Thread Starter
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,121

    Removing extra whitespace

    Does anyone know if there is a command to remove extra whitespace(blank lines) when coding?
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records
    VB.Net | C#

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | SQL Basics

  2. #2
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Removing extra whitespace

    You mean in your source code presumably?

    If so - not that i'm aware of

  3. #3
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: Removing extra whitespace

    No command that I know of as well, but I do know of the DELETE and BACKSPACE keys.
    From my burrow, 2 feet under.

  4. #4

    Thread Starter
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,121

    Re: Removing extra whitespace

    Yeah I know that one too, hoping there was an easier way, especially when there are a ot of blank lines
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records
    VB.Net | C#

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | SQL Basics

  5. #5
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Removing extra whitespace

    Well ultimately your source code is just text files so there's nothing much to stop you writing a tool which runs through the text files and strips empty lines.

  6. #6

    Thread Starter
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,121

    Re: Removing extra whitespace

    Will look into that.
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records
    VB.Net | C#

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | SQL Basics

  7. #7
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Removing extra whitespace

    I think keystone meant you can just copy your code to a txt, run some script through it to delete the empty spaces, then copy it back into your program. Maybe you understood that but there's not much to "look into" and it would be a lot harder if you tried to do it some other way.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  8. #8
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Removing extra whitespace

    Why not edit the vb files directly? They're just text files, no need to copy the text to a separate txt file at all.

    Just run through those vb files line by line, see if line.Trim <> String.Empty, and if so, append that line to a string. At the end of the loop, you save that string as the new vb file, done.

  9. #9
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Removing extra whitespace

    Quote Originally Posted by NickThissen View Post
    Why not edit the vb files directly? They're just text files, no need to copy the text to a separate txt file at all.

    Just run through those vb files line by line, see if line.Trim <> String.Empty, and if so, append that line to a string. At the end of the loop, you save that string as the new vb file, done.
    Yup - thats what I meant - no need to go via intermediate text files, although as a note of caution its worth working on backup copies of your files until you've thoroughly tested your code!

Posting Permissions

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



Click Here to Expand Forum to Full Width