Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove blank lines return from a sub

Posted on 2003-10-30
7
Medium Priority
?
263 Views
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
0
Comment
Question by:ezlee
  • 3
4 Comments
 
LVL 9

Expert Comment

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

Expert Comment

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

Author Comment

by:ezlee
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?

thanks  
0
 
LVL 9

Accepted Solution

by:
bhagyesht earned 400 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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

876 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