// CharIsDigit.cpp : メイン プロジェクト ファイルです。 #include "stdafx.h" using namespace System; int main(array ^args) { // 文字が 10 進数数の数字かどうか判断する if (System::Char::IsDigit(L'5')) { Console::WriteLine("10 進数の数字です。"); } else { Console::WriteLine("10 進数の数字ではありません。"); } // String 型の場合は検査する文字の位置を指定する if (System::Char::IsDigit("AB3DEF", 2)) { Console::WriteLine("10 進数の数字です。"); } else { Console::WriteLine("10 進数の数字ではありません。"); } // 全角数字でも数字と見なす if (System::Char::IsDigit("12345", 3)) { Console::WriteLine("10 進数の数字です。"); } else { Console::WriteLine("10 進数の数字ではありません。"); } // 漢数字は数字と見なさない if (!(System::Char::IsDigit("一二三四五", 3))) { Console::WriteLine("10 進数の数字です。"); } else { Console::WriteLine("10 進数の数字ではありません。"); } // ローマ数字は数字と見なさない if (!(System::Char::IsDigit("TUVWX", 3))) { Console::WriteLine("10 進数の数字です。"); } else { Console::WriteLine("10 進数の数字ではありません。"); } return 0; }