Page 1 of 1

VbScript: Carriage Return or LineFeed in String Parameter

PostPosted: Fri Jan 21, 2011 7:01 am
by Apoleo
Hi, I had the next problem.

When I call a VBScript function and I want to pass a string parameter like these:
Code: Select all
publication.nbSetVar "[%2]" , MyFunction("[%1]")

There may be problems if the string contains CarriageReturn or LineFeed chars.

So before to send the string to the Call action, we have to do this:

Code: Select all
StrReplace "[x]" "[#13][#10]" "[#34]&vbCrLf&[#34]" "[x]" ""
StrReplace "[x]" "[#13]" "[#34]&vbCr&[#34]" "[x]" ""
StrReplace "[x]" "[#10]" "[#34]&vbLf&[#34]" "[x]" ""
Call "VbScriptFunction" "[x]" "Return"

I hope it's useful to someone

PostPosted: Fri Jan 21, 2011 9:51 am
by Alex

Thank you, very useful.