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


C# Match.Result方法代码示例

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


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

示例1: CreateProjectItem

 private ProjectItem CreateProjectItem(Match match)
 {
     var projectTitle = match.Result("${Title}");
     var projectPath = match.Result("${Location}");
     var projectItem = new ProjectItem {Name = projectTitle, Path = projectPath};
     return projectItem;
 }
开发者ID:uluhonolulu,项目名称:Chpokk,代码行数:7,代码来源:SolutionParser.cs

示例2: SheifTopicDataInt

        public static int SheifTopicDataInt(ref string errText, ref TCG.ResourcesService.Resources topic, Match match, string datarole)
        {
            if (string.IsNullOrEmpty(datarole))
            {
                return -1;
            }

            string splitstr = datarole.IndexOf("\r\n")>-1 ? "\r\n" : "\n";
            string[] datas = datarole.Split(new string[] { splitstr }, StringSplitOptions.None);
            if (datas.Length == 0)
            {
                return -2;
            }

            PropertyInfo[] tproperty = topic.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

            for (int i = 0; i < datas.Length; i++)
            {
                if (!string.IsNullOrEmpty(datas[i]))
                {
                    string[] keyvalue = datas[i].Split(',');
                    int rtn = SheifTopicSheValue(ref errText, ref topic, tproperty, match.Result(keyvalue[0]), keyvalue[1]);
                }
            }
            return 1;
        }
开发者ID:wangscript,项目名称:tcgcms,代码行数:26,代码来源:SheifHandlers.cs

示例3: Evaluate

 internal override String Evaluate(Match match) {
   this.lastMatch = match;
   Object[] args = new Object[this.cArgs];
   if (this.cArgs > 0) {
     args[0] = match.ToString();
     if (this.cArgs > 1) {
       int i = 1;
       if (this.groupNumbers != null)
         for (; i <= this.groupNumbers.Length; i++) {
           Group group = match.Groups[this.groupNumbers[i-1]];
           args[i] = group.Success ? group.ToString() : null;
         }
       if (i < this.cArgs) {
         args[i++] = match.Index;
         if (i < this.cArgs) {
           args[i++] = this.source;
           for (; i < this.cArgs; i++)
             args[i] = null;
         }
       }
     }
   }
   Object result = this.function.Call(args, null);
   return match.Result(result is Empty ? "" : Convert.ToString(result));
 }
开发者ID:ArildF,项目名称:masters,代码行数:25,代码来源:regexpreplace.cs

示例4: Evaluate

            private static string Evaluate(Match match)
            {
                var prop = match.Groups[1].Value;
                if (!themeColors.ContainsKey(prop))
                    themeColors[prop] = themeColors["background-color"].Replace("background-color", prop);

                return match.Result(".theme-color-$1(");
            }
开发者ID:wimr,项目名称:Vidyano,代码行数:8,代码来源:Web2Controller.Less.cs

示例5: GetPropertyValue

 /// <summary>
 /// Replace the URL placeholder {p:PropertyName} with the value of the corresponding
 /// property of the parent data object.
 /// </summary>
 /// <param name="m">The regex match that contains property name.</param>
 /// <returns>The property value to use.</returns>
 protected string GetPropertyValue(Match m)
 {
     string prop = m.Result("$1");
     DataObject parent = this.property.GetParent();
     if (parent != null && parent.HasProperty(prop))
         return parent[prop].EditStringValue;
     return m.Value;
 }
开发者ID:Xomega-Net,项目名称:XomegaFramework,代码行数:14,代码来源:LinkPropertyBinding.cs

示例6: GetMatch

 protected virtual string GetMatch(Match m, ViewDataDictionary viewDataDictionary)
 {
     if (m.Success) {
         string key = m.Result("$1");
         if (viewDataDictionary.ContainsKey(key)) {
             return viewDataDictionary[key].ToString();
         }
     }
     return string.Empty;
 }
开发者ID:minhajuddin,项目名称:playground,代码行数:10,代码来源:SimpleView.cs

示例7: MatchViewModel

 protected MatchViewModel(Match model)
 {
     Model = model;
     var groups = model.Groups;
     var capture = model.Captures;// Capture has Index, Length, Value
     var index = model.Index;
     var length = model.Length;
     var next = model.NextMatch();
     var result = model.Result(stringg);
     var x = model.Success;
     var y = model.Value;
     groups[0].
开发者ID:vilinski,项目名称:vilinski.net,代码行数:12,代码来源:MatchViewModel.cs

示例8: GetMatch

 protected virtual string GetMatch(Match m, ViewDataDictionary viewData)
 {
     if (m.Success)
     {
         // 获取匹配后的结果,即 ViewData 中的 key 值,并根据这个 key 值返回 ViewData 中对应的 value
         string key = m.Result("$1");
         if (viewData.ContainsKey(key))
         {
             return viewData[key].ToString();
         }
     }
     return string.Empty;
 }
开发者ID:iraychen,项目名称:LCLFramework,代码行数:13,代码来源:HtmlView.cs

示例9: Evaluate

 internal override string Evaluate(Match match)
 {
     base.lastMatch = match;
     object[] args = new object[this.cArgs];
     if (this.cArgs > 0)
     {
         args[0] = match.ToString();
         if (this.cArgs > 1)
         {
             int index = 1;
             if (this.groupNumbers != null)
             {
                 while (index <= this.groupNumbers.Length)
                 {
                     Group group = match.Groups[this.groupNumbers[index - 1]];
                     args[index] = group.Success ? group.ToString() : null;
                     index++;
                 }
             }
             if (index < this.cArgs)
             {
                 args[index++] = match.Index;
                 if (index < this.cArgs)
                 {
                     args[index++] = this.source;
                     while (index < this.cArgs)
                     {
                         args[index] = null;
                         index++;
                     }
                 }
             }
         }
     }
     object obj2 = this.function.Call(args, null);
     return match.Result((obj2 is Microsoft.JScript.Empty) ? "" : Microsoft.JScript.Convert.ToString(obj2));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:ReplaceUsingFunction.cs

示例10: _ParseANSI

        private string _ParseANSI(Match m)
        {
            string[] ansicode = m.Result( "$1" ).Split( new char[] { ';' } ); //取出所需結果,並切割成字串陣列
            StringBuilder ret = new StringBuilder(); //要回傳的字串

            foreach ( string s in ansicode )
            {
                if ( s == "" | s == "0" )
                {
                    //重置所有控制碼
                    brightness = "f0";
                    forecolor = "7";
                    backcolor = "b0";
                    blink = false;
                    underline = false;
                }
                else if ( s == "1" )
                {
                    //明暗
                    brightness = "f1";
                }
                else if ( s == "4" )
                {
                    //底線
                    underline = true;
                }
                else if ( s == "5" )
                {
                    //閃爍
                    blink = true;
                }
                else if ( s == "7" )
                {
                    //交換顏色
                    string tmp = forecolor;
                    forecolor = backcolor[1].ToString();
                    backcolor = "b" + tmp;
                }
                else if ( s[0].ToString() == "3" )
                {
                    //前景色
                    forecolor = s[1].ToString();
                }
                else if ( s[0].ToString() == "4" )
                {
                    //背景色
                    backcolor = "b" + s[1].ToString();
                }
            }

            ret.Append( opened == true ? "</span>" : "" ); //如果前面有未關閉的標籤,先關閉之

            if ( brightness == "f0" && forecolor == "7" && backcolor == "b0" && blink == false && underline == false )
            {
                /* TODO: 如果標籤跟上一個完全一樣,也不要寫入 */
                //目前控制碼完全跟預設值一樣,所以不寫入新的標籤
                opened = false; //沒有寫新的標籤,所以目前狀態為已關閉
            }
            else
            {
                //寫入新的標籤
                ret.Append( "<span class=\"" + brightness + forecolor + " " + backcolor ); //亮度及前景色、背景色
                ret.Append( blink == true ? " db" : "" ); //閃爍
                ret.Append( underline == true ? " du" : "" ); //底線
                ret.Append( "\">" );
                opened = true; //寫入了新的標籤,所以目前狀態為未關閉
            }

            return ret.ToString();
        }
开发者ID:bcse,项目名称:bbs2html,代码行数:70,代码来源:Form1.cs

示例11: ToUpperChar

        private static string ToUpperChar(Match context, string options, Func<char, char> processingFunction)
        {
            string result = string.Empty;
            Match match = charConversionOptionsParser.Match(context.Result(options));
            if (match.Success)
            {
                // Convert to char array:
                char[] charArray = context.Groups[match.Groups["GroupName"].Value].Value.ToCharArray();

                // Check for specified indices:
                Group indexGroup = match.Groups["Index"];
                if (indexGroup.Success)
                {
                    // Process indices:
                    foreach (Capture capture in indexGroup.Captures)
                    {
                        if (capture.Length > 0)
                        {
                            // Split options into range:
                            string[] range = capture.Value.Split('-');

                            // Parse "from" index:
                            int from;
                            if (!Int32.TryParse(range[0], out from))
                                from = 0;
                            int to = from;

                            // Parse "to" index:
                            if (range.Length > 1)
                            {
                                if (!Int32.TryParse(range[1], out to))
                                    to = charArray.Length - 1;
                            }

                            // Ensure valid range:
                            if (from < 0)
                                from = 0;
                            if (to >= charArray.Length)
                                to = charArray.Length - 1;

                            // Apply processing:
                            for (int i = from; i <= to; i++)
                                charArray[i] = processingFunction(charArray[i]);
                        }
                    }
                }
                // No indices specified. Fallback to default - process the first char (if possible):
                else if (charArray.Length > 0)
                {
                    charArray[0] = processingFunction(charArray[0]);
                }

                result = new string(charArray);
            }
            return result;
        }
开发者ID:sstundzia,项目名称:replacer,代码行数:56,代码来源:AllAvailableSmartTags.cs

示例12: Evaluator

 private string Evaluator(Match match)
 {
     string id = match.Result("$1");
     return _resolvings[id];
 }
开发者ID:taucode,项目名称:taucode,代码行数:5,代码来源:TemplateResolver.cs

示例13: VersionChanger

        private string VersionChanger(Match match)
        {
            // assembly version would be in the format yyyy.dd.mm and assembly file version would be in the format yyyy.dd.mm.revsion
            // first find the type of assembly version
            string versionType = match.Groups[1].Value;

            // get the yyyy.mm.dd
            int yyyy = int.Parse(match.Groups[2].Value);
            int mm = int.Parse(match.Groups[3].Value);
            int dd = int.Parse(match.Groups[4].Value);

            var currentDate = DateTime.UtcNow;

            bool hasRevision = false; // we have the revision number only when change the assembly file version
            int revisionNumber = 1;

            if (!string.IsNullOrEmpty(match.Groups[5].Value))
            {
                hasRevision = true;
                revisionNumber = int.Parse(match.Groups[5].Value.Replace(".", string.Empty));

                // increment revision if same date
                if (yyyy == currentDate.Year && mm == currentDate.Month && dd == currentDate.Day)
                    ++revisionNumber;
                else
                    revisionNumber = 1;
            }

            var dateVersion = currentDate.ToString("yyyy.MM.dd");

            return string.Format(match.Result("[assembly: Assembly{0}Version(\"{1}{2}\")]"),
                versionType, dateVersion, ( hasRevision ? string.Format(".{0}",revisionNumber) : string.Empty));
        }
开发者ID:netsouls,项目名称:eCentral,代码行数:33,代码来源:AutoIncrementTask.cs

示例14: PrintCanvas

 private void PrintCanvas(Match match)
 {
     //this ugliness is just to visualize the solution.
     Console.WriteLine("Visualized:");
     Console.WriteLine();
     var solutionChars = match.Groups["SolutionChar"].GetCaptures();
     var canvas = Regex.Match(match.Result("$_"), @"~[~\s]+\Z").Value;
     var ordered = match.Groups["Filled"].GetCaptures()
         .Zip(solutionChars, (filled, c) => new {Char = c.Value, Order = filled.Length})
         .OrderBy(c => c.Order).Select(c => c.Char).ToArray();
     int index = 0;
     var solution = Regex.Replace(canvas, @"~", m => ordered[index++]);
     Console.WriteLine(solution);
 }
开发者ID:kobi,项目名称:RecreationalRegex,代码行数:14,代码来源:SmallRectanglesTests.cs

示例15: replaceAllEvaluator

		private string replaceAllEvaluator(Match m)
		{
			//	So this method is called for every match

			//	We make a replacement in the range based upon
			//	the match range.
			string replacement = m.Result(_lastReplaceAllReplaceString);
			int start = _lastReplaceAllRangeToSearch.Start + m.Index + _lastReplaceAllOffset;
			int end = start + m.Length;

			Range r = new Range(start, end, Scintilla);
			_lastReplaceAllMatches.Add(r);
			r.Text = replacement;

			//	But because we've modified the document, the RegEx
			//	match ranges are going to be different from the
			//	document ranges. We need to compensate
			_lastReplaceAllOffset += replacement.Length - m.Value.Length;
			return replacement;
		}
开发者ID:dbbotkin,项目名称:PrimeComm,代码行数:20,代码来源:FindReplace.cs


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