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


C# Builtins.MatchData类代码示例

本文整理汇总了C#中IronRuby.Builtins.MatchData的典型用法代码示例。如果您正苦于以下问题:C# MatchData类的具体用法?C# MatchData怎么用?C# MatchData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetGroup

 public static RubyArray GetGroup(ConversionStorage<int>/*!*/ fixnumCast, MatchData/*!*/ self, [NotNull]Range/*!*/ range) {
     int begin, count;
     if (!IListOps.NormalizeRange(fixnumCast, self.Groups.Count, range, out begin, out count)) {
         return null;
     }
     return GetGroup(fixnumCast.Context, self, begin, count);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:MatchDataOps.cs

示例2: GetGroup

 public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]Range/*!*/ range) {
     int begin, count;
     if (!IListOps.NormalizeRange(context, self.Groups.Count, range, out begin, out count)) {
         return null;
     }
     return GetGroup(context, self, begin, count);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:MatchDataOps.cs

示例3: Offset

 public static RubyArray/*!*/ Offset(MatchData/*!*/ self, [DefaultProtocol]int groupIndex) {
     var group = self.GetExistingGroup(groupIndex);
     RubyArray result = new RubyArray(2);
     if (group.Success) {
         result.Add(group.Index);
         result.Add(group.Index + group.Length);
     } else {
         result.Add(null);
         result.Add(null);
     }
     return result;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs

示例4: Offset

 public static RubyArray/*!*/ Offset(MatchData/*!*/ self, [DefaultProtocol]int groupIndex) {
     self.RequireExistingGroup(groupIndex);
     RubyArray result = new RubyArray(2);
     if (self.GroupSuccess(groupIndex)) {
         result.Add(self.GetGroupStart(groupIndex));
         result.Add(self.GetGroupEnd(groupIndex));
     } else {
         result.Add(null);
         result.Add(null);
     }
     return result;
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs

示例5: PreMatch

 public static MutableString/*!*/ PreMatch(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return self.OriginalString.GetSlice(0, self.Index).TaintBy(self, context);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs

示例6: Captures

 public static RubyArray/*!*/ Captures(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return ReturnMatchingGroups(context, self, 1);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs

示例7: MatchToScanResult

 private static object MatchToScanResult(RubyScope/*!*/ scope, MutableString/*!*/ self, RubyRegex/*!*/ regex, MatchData/*!*/ match) {
     if (match.GroupCount == 1) {
         return match.GetValue().TaintBy(regex, scope);
     } else {
         var result = new RubyArray(match.GroupCount - 1);
         for (int i = 1; i < match.GroupCount; i++) {
             MutableString value = match.GetGroupValue(i);
             result.Add(value != null ? value.TaintBy(regex, scope) : value);
         }
         return result;
     }
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:MutableStringOps.cs

示例8: AppendLastCharOfLastMatchGroup

        private static void AppendLastCharOfLastMatchGroup(MatchData/*!*/ match, MutableString/*!*/ result) {
            int i = match.GroupCount - 1;
            // move to last successful match group
            while (i > 0 && !match.GroupSuccess(i)) {
                i--;
            }

            if (i > 0 && match.GroupSuccess(i)) {
                int length = match.GetGroupLength(i);
                if (length > 0) {
                   result.Append(match.OriginalString, match.GetGroupStart(i) + length - 1, 1);
                }
            }
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:14,代码来源:MutableStringOps.cs

示例9: InitializeCopy

 public static MatchData/*!*/ InitializeCopy(MatchData/*!*/ self, [NotNull]MatchData/*!*/ other) {
     self.InitializeFrom(other);
     return self;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:4,代码来源:MatchDataOps.cs

示例10: ToS

 public static MutableString/*!*/ ToS(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return MutableString.Create(self.Value).TaintBy(self, context);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs

示例11: Inspect

 public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return RubyUtils.ObjectToMutableString(context, self);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs

示例12: ValuesAt

        public static RubyArray/*!*/ ValuesAt(ConversionStorage<int>/*!*/ conversionStorage, 
            MatchData/*!*/ self, [DefaultProtocol, NotNull]params int[]/*!*/ indices) {

            RubyArray result = new RubyArray();
            for (int i = 0; i < indices.Length; i++) {
                result.Add(GetGroup(conversionStorage.Context, self, indices[i]));
            }
            return result;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:MatchDataOps.cs

示例13: Select

        public static object Select(RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, MatchData/*!*/ self) {
            RubyArray result = new RubyArray();
            for (int i = 0; i < self.Groups.Count; i++) {
                MutableString value = self.GetGroupValue(context, i);

                object blockResult;
                if (block.Yield(value, out blockResult)) {
                    return blockResult;
                }

                if (RubyOps.IsTrue(blockResult)) {
                    result.Add(value);
                }
            }
            return result;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:16,代码来源:MatchDataOps.cs

示例14: ReturnFrozenString

 public static MutableString/*!*/ ReturnFrozenString(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return MutableString.Create(self.OriginalString).TaintBy(self, context).Freeze();
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs

示例15: ToArray

 public static RubyArray/*!*/ ToArray(RubyContext/*!*/ context, MatchData/*!*/ self) {
     return ReturnMatchingGroups(context, self, 0);
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs


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