On Sep 15, 9:08 pm, John Joyce <dangerwillrobinsondan...@gmail.com>
wrote:
> I must have forgotten something dreadfully simple.
> How do I limit input (from stdin in this case) so that the first non
> AlphaNumeric ends input?
> I fiddled with gets and with $/ to no avail.
> I know I could do input validation later, and I could (should)
> normally use buffered input.
> gets uses the default \n to end input.
> I'd like to end it at the first non-alpha-numeric.
> (Ideally, eventually a language specific version would be beautiful
> to handle unicode codepoint ranges similarly)
>
> Any ideas?
> Or a method that I'm just missing?
Perhaps there's a better way, but my first thought would be to accept
one character at a time, check each one for the required condition,
and continue with processing once you've found what you're looking
for. There was a recent discussion on how to get just one character at
a time without pressing Enter after each --
http://tinyurl.com/38w5fv
if you need it.
Jeremy