当前位置: 首页>>代码示例>>C#>>正文


C# Match.ToString方法代码示例

本文整理汇总了C#中Match.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Match.ToString方法的具体用法?C# Match.ToString怎么用?C# Match.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Match的用法示例。


在下文中一共展示了Match.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: isPalindrome

 static bool isPalindrome(Match word)
 {
     string wordString = word.ToString();
     for (int i = 0; i < wordString.Length; i++)
     {
         if (wordString[i] != wordString[wordString.Length - i - 1])
         {
             return false;
         }
     }
     return true;
 }
开发者ID:nzhul,项目名称:TelerikAcademy,代码行数:12,代码来源:20-Palindrome.cs

示例2: ParseDate

    private static object ParseDate(Match item, string format)
    {
        try
        {
            DateTime parsedDate = DateTime.ParseExact(item.ToString(), format, null);
            return parsedDate;
        }
        catch (Exception)
        {

            return "Cannot parse";
        }
    }
开发者ID:tokera,项目名称:Telerik-Academy,代码行数:13,代码来源:19.CanadaDates.cs

示例3: Evaluate

 /// <summary>
 /// Evaluates whether the text has spaces, page breaks, etc. and removes them.
 /// </summary>
 /// <param name="Matcher">The matched text</param>
 /// <returns>Stripped text</returns>
 private static string Evaluate(Match Matcher)
 {
     string MyString = Matcher.ToString();
     if (string.IsNullOrEmpty(MyString))
         return "";
     MyString = Regex.Replace(MyString, @"\r\n\s*", "");
     return MyString;
 }
开发者ID:pengyancai,项目名称:cs-util,代码行数:13,代码来源:HTML.cs

示例4: RepBold

 public static String RepBold(Match m)
 {
     string str = m.ToString();
     return String.Format("<b>{0}</b>", str);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:5,代码来源:RegexReplaceStringTests0.cs

示例5: Rep3

 public static String Rep3(Match input)
 {
     String s = String.Empty;
     if (input.ToString().Equals("a"))
         s = "A";
     if (input.ToString().Equals("b"))
         s = "B";
     if (input.ToString().Equals("c"))
         s = "C";
     return s;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:RegexReplaceStringTests0.cs

示例6: Rep1

 public static String Rep1(Match input)
 {
     String s = String.Empty;
     if (String.Compare(input.ToString(), "Big", StringComparison.CurrentCultureIgnoreCase) == 0)
         s = "Huge";
     else
         s = "Tiny";
     return s;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:RegexReplaceStringTests0.cs

示例7: dotToDash

 static string dotToDash(Match m)
 {
     string x = m.ToString();
     return x.Replace(@".", @"_");
 }
开发者ID:tcondit,项目名称:PatchTool,代码行数:5,代码来源:PatchLib.cs

示例8: VariableReplacer

        private string VariableReplacer(Match match)
        {
            string returnValue;
            if (varStorage.TryGetValue(match.ToString().Substring(1, match.Length - 2), out returnValue))
            {
                return returnValue;
            }

            return "";
        }
开发者ID:iAmGhost,项目名称:MM-MIUI-Modder,代码行数:10,代码来源:Form_RunModScript.cs

示例9: _replaceEscapeSequenceToChar

 //replace "0A" (in \x0A) into '\n'
 private string _replaceEscapeSequenceToChar(Match foundEscapeSequence)
 {
     char[] hexValues = new char[2];
     //string hexChars = foundEscapeSequence.Value.ToString();
     string matchedEscape = foundEscapeSequence.ToString();
     hexValues[0] = matchedEscape[2];
     hexValues[1] = matchedEscape[3];
     string hexValueString = new string(hexValues);
     int convertedInt = int.Parse(hexValueString, NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo);
     char hexChar = Convert.ToChar(convertedInt);
     string hexStr = hexChar.ToString();
     return hexStr;
 }
开发者ID:caozq19,项目名称:crifanLib,代码行数:14,代码来源:crifanLib.cs

示例10: URL

 private static string URL(Match m)
 {
     string x = m.ToString();
     return x.Link(x);
 }
开发者ID:hguldal,项目名称:bltdrs,代码行数:5,代码来源:Genel.cs

示例11: Rep1

 public static string Rep1(Match input)
 {
     if (string.Compare(input.ToString(), "Big", StringComparison.CurrentCultureIgnoreCase) == 0)
         return "Huge";
     else
         return "Tiny";
 }
开发者ID:eerhardt,项目名称:corefx,代码行数:7,代码来源:RegexReplaceStringTests0.cs

示例12: Username

 private static string Username(Match m)
 {
     string x = m.ToString();
     string username = x.Replace("@", "");
     return x.Link("http://twitter.com/" + username);
 }
开发者ID:hguldal,项目名称:bltdrs,代码行数:6,代码来源:Genel.cs

示例13: Hashtag

 private static string Hashtag(Match m)
 {
     string x = m.ToString();
     string tag = x.Replace("#", "%23");
     return x.Link("http://search.twitter.com/search?q=" + tag);
 }
开发者ID:hguldal,项目名称:bltdrs,代码行数:6,代码来源:Genel.cs

示例14: MatchEval

 /// <summary>
 /// Called to evaluate the HTML fragment corresponding to each 
 /// matching token in the code.
 /// </summary>
 /// <param name="match">The <see cref="Match"/> resulting from a 
 /// single regular expression match.</param>
 /// <returns>A string containing the HTML code fragment.</returns>
 protected override string MatchEval(Match match)
 {
     if (match.Groups[1].Success) //comment
     {
         var reader = new StringReader(match.ToString());
         string line;
         var sb = new StringBuilder();
         while ((line = reader.ReadLine()) != null)
         {
             if (sb.Length > 0)
             {
                 sb.Append("\n");
             }
             sb.Append("<span class=\"rem\">");
             sb.Append(line);
             sb.Append("</span>");
         }
         return sb.ToString();
     }
     if (match.Groups[2].Success) //string literal
     {
         return "<span class=\"str\">" + match.ToString() + "</span>";
     }
     if (match.Groups[3].Success) //preprocessor keyword
     {
         return "<span class=\"preproc\">" + match.ToString() + "</span>";
     }
     if (match.Groups[4].Success) //keyword
     {
         return "<span class=\"kwrd\">" + match.ToString() + "</span>";
     }
     System.Diagnostics.Debug.Assert(false, "None of the above!");
     return ""; //none of the above
 }
开发者ID:491134648,项目名称:Farmer,代码行数:41,代码来源:CodeFormat.cs

示例15: MyMatchEvaluator

    public static string MyMatchEvaluator(Match m)
    {
        matched = true;
        string matchedString = m.ToString();

        if (addJsType)
        {
            var lastDir = "";
            {
                // add "../../...." to reach Assets/
                int i = 0;
                var np = nextPath;
                while (true)
                {
                    i = np.IndexOf('/', i);
                    if (i < 0) break;
                    lastDir += "../";
                    i++;
                }
            }

            string JsTypeSection = string.Format("[JsType(JsMode.Clr,\"{0}{1}{2}{3}{4}\")]",
                lastDir, JSBindingSettings.sharpKitGenFileDir, nextPath, m.Groups["ClassName"], JSBindingSettings.jsExtension);

            // ���JsType�����Ѿ���������ͬ���Ͳ�Ҫ���ˣ�ֱ�ӷ�����ͬ�Ĵ�
            if (matchedString.IndexOf(JsTypeSection) >= 0)
                return matchedString;
            else
                return string.Format("\n{0}\n{1}", JsTypeSection, m.Groups["ClassDefinition"]);
        }
        else
        {
            // ���û�� JsType���Ͳ�Ҫ�滻�ˣ���Ϊ�滻��Ӹ�\n���ᵼ���ļ��޸�
            // ��Ȼ�������������� JsType���Ǿ��滻һ�£��Ӹ����У�Ҳû��
            if (matchedString.IndexOf("JsType") < 0)
                return matchedString;
            else
                return string.Format("\n{0}", m.Groups["ClassDefinition"]);
        }
    }
开发者ID:shuidong,项目名称:qjsbunitynew,代码行数:40,代码来源:JSAnalyzer.cs


注:本文中的Match.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。