• 根据前后的子串求中间串的函数


    using System.Text.RegularExpressions;   
      /// <summary>
      /// 给出一个字符串,前面的子串和后面的子串,返回中间的子串(删除空格)
      /// </summary>
      /// <param name="s"></param>
      /// <param name="s1">如果前面要顶头,s1=""</param>
      /// <param name="s2">如果后面要是结尾,s2="$"</param>
      /// <returns></returns>
      private string GetMod(string s,string s1,string s2)
      {
       Regex re=new Regex(s1 + @".*" + s2);
       Match ma=re.Match(s);
       if( ma.Success)
        return ma.Value.Substring(s1.Length,ma.Length-s1.Length -s2.Length).Trim();
       else
        MessageBox.Show("未在 " + s +" 中发现适合的字符串!");
        return "";
      }
  • 相关阅读:
    linux:shell:tree
    html5,css3
    asp.net web forms page life cycle
    Unobtrusive Javascript
    Multitier architecture
    C#接口的显示实现和隐式实现
    Modernizr
    android w700
    debian e42 wifi
    mstest run dll
  • 原文地址:https://www.cnblogs.com/jetz/p/147052.html
Copyright © 2020-2023  润新知