Remove blank lines return from a sub

Posted on 2003-10-30
Last Modified: 2010-05-18
In VB script, I want to remove the blank lines from a sub routine when it is called in the main script.
For example: My VBscript reads like:
call sub1(argu1)

sub sub1(argu1)
End sub

The output of sub1 is like:
<blank line>
some data
other data
<blank line>
yet another data

How could I remove the <blank line> and make it feel better.

Thanks, ezlee
Question by:ezlee
  • 3

Expert Comment

ID: 9649172
take the output in a string then call the following
strMystring=Replace(strMystring,vbcrlf & vbcrlf,vbcrlf)
then continue with the output

Expert Comment

ID: 9649185
if the above doesnt work check what characters are in the blank line and prefex and suffex those characters with vbcrlf

Author Comment

ID: 9655638
sorry, I am new in VB scripting,
could you give me more details?
the output that containing blank lines are from the "sub",
how can I do some trimming when I call it from main?


Accepted Solution

bhagyesht earned 100 total points
ID: 9655663
change the sub to a function and instead of output from sub make the function return the output as  a string then replace it.
ie from
sub mysub
...some output mostly print or debug.print
end sub

function mysub
mysub=mysub+<output string>
end function

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
countPairs challenge 7 68
groupNoAdj 7 86
Filename to be appended with DateTimeof Download 3 47
iSeries email authority 4 26
A short article about a problem I had getting the GPS LocationListener working.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now