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

x
?
Solved

String replace not working

Posted on 2013-11-05
6
Medium Priority
?
252 Views
Last Modified: 2013-11-25
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, " ")
0
Comment
Question by:Soluga
6 Comments
 
LVL 15

Expert Comment

by:unknown_routine
ID: 39624065
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.
0
 
LVL 1

Author Comment

by:Soluga
ID: 39624139
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.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 39624195
I'm hoping you are using the RETURN VALUE of Replace rather than expecting the string to be altered.....Replace returns a new string.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 1

Author Comment

by:Soluga
ID: 39624201
Doh!

strHtml = strHtml.Replace(strHtmlReplace, "")

Thanks Anyway
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 39624221
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
0
 
LVL 5

Accepted Solution

by:
MohitPandit earned 2000 total points
ID: 39626422
Hello,

I tried to check aforesaid code and you need to store in variable then you will see that it is doing replace if you are playing with same variable i.e. strHtml

Please find below code:

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

        strHtml = strHtml.Replace(strHtmlReplace, " ")
        MessageBox.Show(strHtml)

Open in new window


Best Regards,
Mohit Pandit
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

972 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