PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > input question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
input question

Réponse
 
LinkBack Outils de la discussion
Vieux 16/09/2007, 03h08   #1
John Joyce
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?

  Réponse avec citation
Vieux 16/09/2007, 04h46   #2
yermej@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: input question

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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h30.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08679 seconds with 10 queries