This is the question:
Java - Check if a string only contains symbols
What's a good method for checking if a string only contains symbols. i.e. if one of my properties only contains a "%" or "---" or "$%^&". I'm trying to pick out properties which aren't words.
It's not a very good one but can be easily answered with one line of code, I think that you should either do that (and 3 people did that) or not answer it at all.
The answer I'm asking about is:
Regular Expressions is a way to go. Since Pattern is going to be static, keeping a static copy of compiled Pattern will get you Best time complexity. Check out class named Pattern and it's compile and match method
This technically answers the question but it's not a good answer, I downvoted and commented:
This is too general to be a useful answer
The answerer responded with:
@Oleg Pattern.compile has been mentioned in my answer which is very specific
From looking at Answering and searching meta I don't see anything that will contradict his point and his answer is valid.
Is his answer a valid and/or good answer for Stack Overflow? (I'm kind of asking if it's good enough to be valid)
Update
For questions there is What topics can I ask about here? which sets a very low bar for a question that can be asked here and How do I ask a good question? which sets a much higher bar for what constitutes a good question.
For answers there is only How do I write a good answer? and it sets an extremely low bar. I was looking for some consensus on what constitutes a good answer. To me it's very clear that in this case it's not, that question should be answered with code or not answered at all.
The responses I got so far are:
- This answer is better than an answer with code
- It's a bad answer
- Not good but it's appropriate to the quality of the question so there is no problem with it
- A philosophical point about what is "good"
So it looks like there is no consensus and/or desire to create a higher bar for answers. It's possible to tell someone 'your question is on topic but not really what we are looking for, please try to do better next time' for some reason people are not interested to have the same thing for answers.
Also whether the question is good or not is not relevant I'm talking about a situation where it was asked and answered take it as a given.
Update 2
@Makoto is the only one who actually answered my question so I accepted his answer. I mostly got what I wanted but some more votes will be better, please upvote his answer if you think the answer I asked about is "fine" or downvote if you think it's not.
If you don't know what "fine" means or still don't understand what I'm asking, this question is not for you, I don't know how to explain myself better.