<div class="cnblogscode">
@H403_0@ <span style="color: #0000ff;">public <span style="color: #0000ff;">bool IsNum(<span style="color: #0000ff;">string<span style="color: #000000;"> Str)
{
</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>