29

I recently got question banned. I'm not sure exactly when it happened, because the last time I posted a question was something like a month ago. When I first joined the site, I didn't realize that it was bad to delete answers, so I made some mistakes. I deleted 2 or 3 questions that had a downvote or two. Also, the first question I ever asked was terrible, so I have read that I need to edit it and improve it.

However, I'm not sure how to go about this. If someone would be so kind, I would really appreciate it if someone could tell me what, specifically, is wrong with my question and how I can improve it:

String.Trim not trimming semicolon (C#)

11
  • 3
    @CodyGray I really appreciate your help. This is the most productive thing that anyone's ever done to me on this site. Thank you very much. I truly appreciate it.
    – user7159857
    Aug 25, 2017 at 1:22
  • 10
    That is my job. :-) You are welcome. For a bit of context: these types of questions are totally legitimate on Meta and should be encouraged, but the community tends not to react as well to them as would be ideal. You will undoubtedly receive some downvotes on this question. Please don't think too much of those. Downvotes here don't affect your reputation, and they often just reflect disagreement. (Not necessarily disagreement with trying to improve, but more often disagreement that the question is salvageable.) Aug 25, 2017 at 1:24
  • The only thing I see glaringly wrong with it is the "(C#)" in the title and that wasn't even added by you. Very likely not the cause of the down vote but if you do edit the question later you should also take that out.
    – BSMP
    Aug 25, 2017 at 1:31
  • I don't see any heavily-downvoted questions on your profile right now, but I have less than 10K rep and can't see deleted posts. Aug 25, 2017 at 18:09
  • @EJoshuaS That's because they (for some crazy reason) got another 3 or 4 up-votes right after I posted this question. The only reason I can think of is because CodyGray was kind enough to re-open this question and I guess people decided to look at my other questions and give them up-votes??? Anyways, I'm un-question banned now. Thanks everyone!
    – user7159857
    Aug 25, 2017 at 18:31
  • @G5W I deleted my own poorly received questions because they had a couple down-votes and I didn't realize that deleting questions was bad. Apparantly deleted questions with poor vote counts still count towards question banned.
    – user7159857
    Aug 25, 2017 at 18:33
  • @TheMCProgrammer You can undelete questions. If you don't have a link to them in your profile, just ask a friendly neighbourhood 20k+ user to help you out (in chat, not by commenting on their questions / answers!).
    – wizzwizz4
    Aug 26, 2017 at 15:14
  • @wizzwizz4 I didn't know that. Can a 20k+ user still undelete questions that are over 6 months old and deleted by me?
    – user7159857
    Aug 26, 2017 at 21:54
  • 1
    A user with 10k+ reputation can see deleted questions, but they won't be able to find them unless they already have the link. You need a moderator to see a particular user's deleted questions. You have three; they are: stackoverflow.com/questions/43896724, stackoverflow.com/questions/41317026, and stackoverflow.com/questions/41307620. I consider the first one to be completely unsalvageable and recommend leaving it deleted. The second is probably pretty easily salvageable. The third one will require a lot of work to turn into a real question, but it is possible. Aug 27, 2017 at 8:14
  • @wizzwizz4: deleted:yes only works for 10k users' own posts. Only diamond mods can search for others' deleted posts. Aug 27, 2017 at 12:55
  • It's surprising just how wrong I was.
    – wizzwizz4
    Aug 27, 2017 at 17:36

1 Answer 1

17

The cause of downvote is lack of an MCVE (in particular, the "minimal" part). I understand that shortening your sample to just one line ";\r\n".Split('\n')[0].Trim(';') is too obvious, but 3-4 lines should be more than enough.

Also, "because the semicolon is not the last character in the string" is the answer. This is already stated in the question, without an explanation of why you have not tried to figure out what that "last character in the string is".

To fix:

  • Trim down sample to just the necessary parts. There is absolutely no reason to post your whole C# code as a string constant (that also breaks code highlighting). Something like the following would be enough:

    var text = @";
    ";
    
  • Remove all unrelated code that is there and replace it with calls to Trim you've tried, along with the output:

    Console.WriteLine(split[0].Trim(';')); // prints ;
    
  • Follow up on your own idea, "Could it be because the semicolon is not the last character in the string?" - at the very least:

    Console.WriteLine(split[0].Length); // shows 2???
    
  • Consider turning the question around altogether and ask about what the actual problem is (splitting leaves \r). Generally, such an edit would be questionable, but in this case answers actually solve the underlying problem and not what you've asked, so it would be okay. Maybe just updating the title to something like "Splitting by new line keeps invisible characters" would work.

You must log in to answer this question.