本文整理汇总了C#中IronRuby.Builtins.MatchData.GetGroupValue方法的典型用法代码示例。如果您正苦于以下问题:C# MatchData.GetGroupValue方法的具体用法?C# MatchData.GetGroupValue怎么用?C# MatchData.GetGroupValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Builtins.MatchData
的用法示例。
在下文中一共展示了MatchData.GetGroupValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGroup
public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [DefaultProtocol]int start, [DefaultProtocol]int length) {
if (!IListOps.NormalizeRange(self.Groups.Count, ref start, ref length)) {
return null;
}
RubyArray result = new RubyArray();
for (int i = 0; i < length; i++) {
result.Add(self.GetGroupValue(context, start + i));
}
return result;
}
示例2: 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;
}
}
示例3: AppendGroupByIndex
private static void AppendGroupByIndex(MatchData/*!*/ match, int index, MutableString/*!*/ result) {
var value = match.GetGroupValue(index);
if (value != null) {
result.Append(value);
}
}
示例4: 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;
}
示例5: ReturnMatchingGroups
private static RubyArray/*!*/ ReturnMatchingGroups(RubyContext/*!*/ context, MatchData/*!*/ self, int groupIndex) {
Debug.Assert(groupIndex >= 0);
if (self.Groups.Count < groupIndex) {
return new RubyArray();
}
RubyArray result = new RubyArray(self.Groups.Count - groupIndex);
for (int i = groupIndex; i < self.Groups.Count; i++) {
result.Add(self.GetGroupValue(context, i));
}
return result;
}