首页 > Web开发 > 详细

asp.net常用字符串函数

时间:2016-05-26 18:56:43      阅读:214      评论:0      收藏:0      [点我收藏+]
/// <summary>
        /// 提取字符串中的数字
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string getNumber(string str)
        {
            return System.Text.RegularExpressions.Regex.Replace(str, @"[^\d{2}-]*", "");
        }

  截取字符串:原字符:{Width=300, Height=200}

size = size.Replace("{Width=", "");//替换
size = size.Replace(" Height=", "");
size = size.Substring(0, size.Length - 1);//去掉最后一个

  截取之后:300,200

asp.net常用字符串函数

原文:http://www.cnblogs.com/hllive/p/5532163.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!