You are viewing limited content. For full access, please sign in.

Question

Question

replace function in script

asked on May 23, 2014

 I cannot locate the Replace() function in the script activity in workflow. Is there another function that I should use instead?

0 0

Answer

SELECTED ANSWER
replied on May 23, 2014

Are you talking about String.Replace()? If so, it'll only be available on a string object.

 

string someString = "some value";
someString = someString.Replace("some", "new");

//someStrong now equals "new value"

 

1 0

Replies

replied on May 23, 2014

I was trying in the vb.script. This works in the c#. Can you tell me how to replace a double quote (") with a space? would it be:

 

somestring.replace("", " ");

 

thanks so much already! 

0 0
replied on May 23, 2014 Show version history

In VB.NET you double up quotes when you need to use them as a literal.

 

Dim someString As string = """some"" thing"
'someString equals: "some" thing

someString = someString.Replace("""", "_")
'someString equals: _some_ thing

 

2 0
replied on July 22, 2014 Show version history

The other trick is to add the correct reference. At the top of your script be sure to include:

 

"Imports Microsoft.VisualBasic"

 

Then Replace, vbTab, SubString, all that stuff will work.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.