Input question

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?

On Sep 15, 9:08 pm, John J. [email protected]
wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs