Skip to main content
added 11 characters in body
Source Link
Gerhard
  • 7.2k
  • 8
  • 60
  • 85

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a continuous binary string from a serial port where problematic characters needs to be removed for reporting.

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a binary string from a serial port where problematic characters needs to be removed for reporting.

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a continuous binary string from a serial port where problematic characters needs to be removed for reporting.

spelling
Source Link
ADyson
  • 62.9k
  • 16
  • 86
  • 100

Checking if an 8 bit character is alfa numericalphanumeric

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I I am reading a binary string from a serial port where problematic characters needs to be removed for reporting.

Checking if an 8 bit character is alfa numeric

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a binary string from a serial port where problematic characters needs to be removed for reporting.

Checking if an 8 bit character is alphanumeric

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a binary string from a serial port where problematic characters needs to be removed for reporting.

Source Link
Gerhard
  • 7.2k
  • 8
  • 60
  • 85

Checking if an 8 bit character is alfa numeric

This C# code would return an unexpected result:

char x = Convert.ToChar(0xff); Console.WriteLine( Char.IsLetterOrDigit(x)); 

It prints True were I was hoping for a False. I assume this is because IsLetterOrDigit is expecting a Unicode character as input versus the extended ascii value I convert from.

How could I make this work? I am reading a binary string from a serial port where problematic characters needs to be removed for reporting.