tags:

views:

19

answers:

1

Hi Guys,

I am using VBScript for programming

I have three vairables and there value is coming through vbscript program.

publicationPath = "/test/english"

publicationUrl = "/101/english"

publishedPath = "/test/english/about/india/delhi.aspx"

Now if you see the publicationPath and publishedPath's "/test/english" is same. Now I want that this will be replaced with the publicationUrl value, I mean the final url will be as given below.

pagePublishPath = /101/english/about/india/delhi.aspx"

Please suggest the solution using VBScript

Thanks.

+2  A: 

To replace a substring with another substring within a string, use the Replace function:

pagePublishPath = Replace(publishedPath, publicationPath, publicationUrl, 1, 1, vbTextCompare)
Helen
Unless you are including a lot of built-in constants, you will need to add vbtextcompare = 1, or just substitute 1 in the line.
Remou
@Remou: `vbTextCompare` is an intrinsic constant in VBScript, and there's no need to define it (at least in WSH scripts).
Helen
@Helen so it is, apologies.
Remou
@Remou: np :) ` `
Helen