找回密码
 注册
搜索
热搜: 回贴

ASP.NET技巧:正则表达式提取数字

2009-12-13 12:37| 发布者: admin| 查看: 53| 评论: 0|原作者: 千年缘

【/// ///获取字符......


///
/// 获取字符串中的数字
///

///
///
private int GetNumber(string par)
{
string strTempContent =par;
strTempContent = System.Text.RegularExpressions.Regex.Replace(strTempContent, @"[^\d]*", "");
return Convert.ToInt32(strTempContent);
}

最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 19:14 , Processed in 0.444894 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部