码迷,mamicode.com
首页 > Web开发 > 详细

asp.net常用字符串函数

时间:2016-05-26 18:59:07      阅读:175      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!