vb.net

How do you determine if a Char is a Letter from A-Z?


How do you determine if a letter is in the range from A-Z or Digit 0-9? We are getting some corrupted data "I_999Š=ÄÖÆaðøñòòñ".

I thought I could use Char.IsLetterOrDigit("Š") to ID the corrupted data from "I_999Š", but unexpectedly this is returning true. I need to trap this, any thoughts?


Solution

  • Well there are two quick options. The first is to use a regular expression the second is to use the Asc() function to determine if the Ascii value is in the range of those allowable characters. I would personally use Asc() for this.