-10

My answer on: Is String.Contains() faster than String.IndexOf()?

was reviewed and undeleted 19 hours ago as per the discussion on this thread:

"Why was my upvoted answer deleted?"

Today (8 hours ago) is was summarily deleted by another user after being undeleted by the moderator.

There have been no edits/changes to the post since originally being undeleted.

I would like to know what the heck is going on??

Is there no coordination or "source control" like comments between the various moderators/users on Stack Overflow?

  • 5
    It would be advisable for your to post the content of the deleted answer so users who do not have 10K rep on Stack Overflow can see what all of the hubbub is about. – psubsee2003 Oct 2 '13 at 0:25
12

Your posts have been deleted because they have a few issues:

  1. Self Promotion - whether it's your friend's blog or yours, posting links to a singular blog in all your answers is frowned upon. That's made even worse by

  2. Answering years old questions with no new information but with only links

Links are supplemental, they should never be the primary source of your answer. If you find yourself linking to the same guy's blog all the time, he'd better be an expert in the field ( like Eric Lippert ), and you probably shouldn't link to your friend's blog. Now, if you are somehow friends with Eric Lippert, the above still applies.

Posting a link should be an "arm's length" transaction. When it's not, you risk your answer being deleted due to our self promotion guidelines.

  • 2
    What is an "arm's length" transaction? – doppelgreener Oct 2 '13 at 4:45
  • 2
    @JonathanHobbs as far as I remember "not you or your immediate relatives and acquaintances". Like, no one you regularly shake hands with. – Mołot Oct 2 '13 at 7:20
6

Your answer reads:

I know this is already answered, but while searching for a solution too for this, I came across this blog, and thought it might be helpful. The blog benchmarks numerous techniques for testing if a string contains a string:

http://blogs.davelozinski.com/curiousconsultant/csharp-net-fastest-way-to-check-if-a-string-occurs-within-a-string

Some of the techniques include: String.Contains() s.IndexOf() Regex.IsMatch() Linq.Contains() and other techniques including parallel methods.

IndexOf, Regex, and Linq were the slowest options.

The fastest was:

for (int x = 0; x < ss.Length; x++)
        for (int y = 0; y < sf.Length; y++
               c[y] += ((ss[x].Length - ss[x].Replace(sf[y], String.Empty).Length) / sf[y].Length > 0 ? 1 : 0);

where ss is the array of strings to search, sf is the array of strings to search for.

If anything I would have thought the above code would not be the fastest because of all the string operations performed (replace, length, etc).

His code is publicly posted so anyone can test the micro-optimizing on their own machines.

Makes for an interesting read.

Look at the comment I just posted below the question:

This blog benchmarks numerous techniques for testing if a string contains a string: http://blogs.davelozinski.com/curiousconsultant/csharp-net-fastest-way-to-check-if-a-string-occurs-within-a-string

That's how you should do this.

While your answer does add useful detail to the post, Stack Overflow is a Q&A site, and the question was already definitively answered here, three years ago.

Had the question asked "What is the fastest way to find a string within a string," then your answer would have been definitive.

  • 16
    That user has 16 deleted answers, and all the answers have this format. Information, link to the exact same blog, and posted years later. I deleted it because it runs afoul of our self promotion guidelines. – George Stocker Oct 2 '13 at 0:56
  • @GeorgeStocker: Ah, didn't know that. Is it his blog? – Robert Harvey Oct 2 '13 at 0:57
  • 3
    I have no idea. What I do know is that it doesn't smell on the up-and-up. – George Stocker Oct 2 '13 at 0:58
  • 6
    He says it's his firend's blog: meta.stackexchange.com/a/198949/16587 – George Stocker Oct 2 '13 at 1:02
  • It is a friend's blogs. – please delete me Oct 2 '13 at 1:41
  • 1
    It seems to me Stack Overflow is more of a "moving target" with "guidelines". Some mods say that particular post is ok (and approved it for undeletion); others say no it's not (and promptly redeleted it); some mods said more information was needed such as code examples for it to be relevant and approved (which was given to have the answer undeleted); now what I'm reading is because the question was answered years ago (acknowledged in the original posting of the answer) it doesn't matter what someone adds (such as links to a source to support said info) because it will be deemed irrelevant. – please delete me Oct 2 '13 at 1:49
  • 14
    @FireMyst: They don't have different guidelines, it's just that the moderator who originally deleted your post didn't know about the 15 other posts all intended to promote a particular blog. No moderator would consider that acceptable behavior. – David Robinson Oct 2 '13 at 1:55
  • 1
    @FireMyst this is not an advertising site, not in that way at least. Your post ran afoul of the rules - you just have to accept and learn from it. – user234239 Oct 2 '13 at 5:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .