WTF Next?

Dev ramblings from a master of nothing.

  Home  |   Contact  |   Syndication    |   Login
  130 Posts | 0 Stories | 77 Comments | 0 Trackbacks

News

INETA Community Speakers Program
GeeksWithBlogs.net: WTFNext's hosting!

View Stacy Vicknair's profile on LinkedIn

Twitter







Tag Cloud


Archives

Post Categories

Community Links

User Groups

In a previous .NET Tip, I compared IsDigit to IsNumber for parsing numbers from a string. I wanted to point out that it is true that Char.IsDigit does only get decimal digits, but to further elaborate that this isn't just 0 through 9.

Sure, 0 through 9 are the decimal digits that most of us would consider the only ones. However, with the globalization being a major push for .NET, we've got to think outside of our local scope. Char.IsDigit will also pick up other culture specific decimal digits. What this means is that other languages, such as Arabic, will have their own representations of digits, and those are also accepted within Char.IsDigit.

So, if you are looking to use IsDigit, be certain you are using it properly. Otherwise, you might be better off with regular expressions. However, be warned, even regular expressions aren't immune to this issue.

 

Technorati Tags:
posted on Tuesday, December 30, 2008 2:32 PM