Reputation: 3796
I have this string from which I want to remove the Hosting html part.
string r = @"2014-09-18 20:59:53|
<!-- Hosting24 Analytics Code -->
<script type=""text/javascript"" src=""http://stats.hosting24.com/count.php""></script>
<!-- End Of Analytics Code -->";
But
r = r.Replace(
@"<!-- Hosting24 Analytics Code -->
<script type=""text/javascript"" src=""http://stats.hosting24.com/count.php""></script>
<!-- End Of Analytics Code -->","");
Is not working. I get the same annoying original string.This has been driving me crazy
Upvotes: 0
Views: 1257
Reputation: 37020
From examining your string, it appears you're trying to remove everything after the first bar
character. If that's the case, this might work better:
r = r.Split('|')[0];
Upvotes: 1
Reputation: 86064
The code you've posted does remove the string as you are trying to. You can verify this yourself here.
https://dotnetfiddle.net/p4lchi
The string you are ultimately examining must come from some other source.
Upvotes: 0