Code.GeekInterview.com
 
Code Samples VB.NET
 

Remove Blank Lines from Script Files


Code ResourceAuthor: Lokesh M  

Difficulty Level:

Published: 26th Aug 2007   Read: 4279 times  

Filed in: VB.NET
Add Comment


 

 

Sponsored Links


 

 

Sometimes while using FTP one may find the script files transferred to have additional blank lines, which could make the script clumsy and messy to read or modify.  Here is a simple code to remove Blank Lines in Script Files.

Note :

  1. Please take a backup of original script or text file.
  2. This code makes no distinction between intentional blank line and the lines that have been appended when transferring via FTP.
 


Sample Code
  1.  
  2. Public Function RemoveLines()
  3.     Open "C:my_script.php" For Input As #1
  4.     Open "C:my_script_new.php" For Output As #2
  5.    
  6.     While Not EOF(1)
  7.         Line Input #1, TextLine
  8.         TextLine2 = Trim(TextLine)
  9.         If Len(TextLine2) > 0 Then
  10.             Print #2, TextLine
  11.         End If
  12.     Wend
  13.    
  14.     Close #1
  15.     Close #2
  16. End Function
  17.  
Copyright GeekInterview.com


Next Article: Split Name to First and last Name


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    



Popular Coders

# Coder NameHits
1. Lokesh9188
2. supersubra5461
3. jsubha20095267
4. Lokesh M4280
5. sureshrndsoft3183
6. Biswabed Dash2261
7. alaa_eng1647

Active Coders

# Coder NameCodes
1. supersubra1
2. Biswabed Dash1
3. Lokesh1
4. Lokesh M1
5. jsubha20091
6. sureshrndsoft1
7. alaa_eng1

Refined Tags