Timeline for Validating Yes/No answers in C++
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 21, 2017 at 12:53 | comment | added | USD Matt |
This is the first thing I thought of, and I'm sure i've used various "proper" utilities that work this way. You're asking the user to supply [y/n] in the question, and so it shouldn't come as a surprise that entering a string starting with y gets accepted as such. In my opinion trying to match a complete set of specific strings is a bit over-engineered for this.
|
|
| Nov 21, 2017 at 1:40 | comment | added | John3136 |
Yes it does - which is kind of in keeping with the original question plus mixtures, such as yeS, yES, which I didn't intend to accept but it's a consequence of my code - As I said it's the simple approach.
|
|
| Nov 21, 2017 at 1:39 | comment | added | Wes Toleman |
Unfortunately this returns true on inputs such as Yowsers!
|
|
| Nov 20, 2017 at 23:57 | history | edited | John3136 | CC BY-SA 3.0 |
added 397 characters in body
|
| Nov 20, 2017 at 23:12 | history | answered | John3136 | CC BY-SA 3.0 |