How do I recognize space characters in keyboard input?

  • Thread starter Thread starter steve bull
  • Start date Start date
S

steve bull

I would like to recognize whitespace or nonascii characters in keyboard input. Is there an easy way to do this test? I
could do

e.KeyChar < '!' || e.KeyChar > '~'

but this seems to make the assumption that the user is inputting ascii characters - but maybe they are using some other
character set.

Can I use \s or is this for regular expression use only.


sorry it is such a basic question.

Thanks,

Steve
 
Hi,

Have you tried the static Char.IsXXX set of functions (Char.IsWhitespace ,
Char.IsLetter, etc.) They take a char as input and handle Unicode as well.

They may provide the functionality you are looking for.

\s only works as part of regular expressions.

Best regards,

Rodger

Time Management Guide - Make better use of your time
<http://www.TimeThoughts.com/timemanagement.htm>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top