Link to home
Start Free TrialLog in
Avatar of Soluga
Soluga

asked on

String replace not working

Hi,

I am trying to remove the flash string in the code behind, so the string I want to actually remove is

wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowfullscreen="1" play="1" quality="high" loop="0"

I am using the code below but it does not seem to remove it. Would be grateful for any help.
Thanks

Dim strHtml As String
Dim strHtmlReplace As String
 strHtml = pageEditor.Content
  strHtmlReplace = "wmode=""transparent"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" allowfullscreen=""1"" play=""1"" quality=""high"" loop=""0"""

            strHtml.Replace(strHtmlReplace, " ")
Avatar of unknown_routine
unknown_routine
Flag of United States of America image

I don't see an issue with your code.

where this HTML file is located? is it on web server? if so, a permission issue may prevent you from changing it.  Use strHtml.IndexOf to see if this return a positive value and confirm the permission issue.


 Try to if you can change it if you copy it to a local drive.
Avatar of Soluga
Soluga

ASKER

I changed it to .Remove and now I get the error

Message=Conversion from string "wmode="transparent" type="applic" to type 'Integer' is not valid.
I'm hoping you are using the RETURN VALUE of Replace rather than expecting the string to be altered.....Replace returns a new string.
Avatar of Soluga

ASKER

Doh!

strHtml = strHtml.Replace(strHtmlReplace, "")

Thanks Anyway
Just wanted to be sure.

If that's the case, the only problem I can't actually SEE is whether the white space truly matches...perhaps there are some mismatches between spaces and tabs or newlines.  If you aren't sure about those you could use a pattern replacement where you indicate ANY whitespace with \w
ASKER CERTIFIED SOLUTION
Avatar of MohitPandit
MohitPandit
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial