Thanks for this. Is it fair to say, then, that only Arabic numerals are counted as digits? Even though other numeric characters have integer values?
-----Original Message----- From: Jonathan Pryor [mailto:[EMAIL PROTECTED] Sent: 05 October 2004 11:32 To: Polton, Richard (IT) Cc: Jambunathan Jambunathan; [EMAIL PROTECTED] Subject: RE: [Mono-list] conversions On Tue, 2004-10-05 at 04:34, Polton, Richard (IT) wrote: > In fact, habing given it further thought, I have a couple of questions: > > i) if I sit at a Japanese terminal (for example) and enter '-', i.e. > ichi or 'one', is this a valid Unicode character? Yes. > ii) how wide is the 'char' datatype? I assume it contains Unicode > rather than single-byte ASCII. 16-bit unsigned value. It supports Unicode. > iii) if entering 'ichi' is valid, and char contains Unicode, then I > suspect that the below subtration will return a number substantially > greater than one. No. At least, not if it's remotely like CVS HEAD: public static int Val (char Expression) { if (char.IsDigit(Expression)) { return Expression - '0'; } else { throw new ArgumentException(); } } Ichi isn't a digit, so it will generate an ArgumentException. (Assuming that Ichi is Unicode U+4E00, which certainly looks like '-'. It's in the Unicode category "Letter, Other".) The subtraction should be safe, as (1) it's only done on digits, and (2) Unicode follows the ASCII character ordering (for glyphs 0-127), which permits this subtraction. - Jon -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
