<div class="cnblogs_code">
IsNum( </span><span style="color: #0000ff;">string</span> Rx = <span style="color: #800000;">@"</span><span style="color: #800000;">^[1-9]\d*$</span><span style="color: #800000;">"</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (Regex.IsMatch(Str,Rx))
{
</span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">;
}
</span><span style="color: #0000ff;">else</span><span style="color: #000000;">
{
</span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">;
}
}</span></pre>