Solved

String replace not working

Posted on 2013-11-05
6
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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