本文整理汇总了C#中The类的典型用法代码示例。如果您正苦于以下问题:C# The类的具体用法?C# The怎么用?C# The使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
The类属于命名空间,在下文中一共展示了The类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveValuesInternal
private static string RemoveValuesInternal(string source, int? quantity, string extraction, StringComparison comparisonRule, The position = The.Beginning)
{
if (quantity < 0)
throw new ArgumentOutOfRangeException("quantity", "Negative quantity is not supported");
if (quantity == 0)
return source;
return source.Remove(extraction,
(s, e) =>
{
var indexes = source.IndexesOf(extraction, comparisonRule, position);
if (quantity != null)
indexes = indexes.Take(quantity.Value);
if (position == The.End)
indexes = indexes.Reverse();
var indexesArray = indexes.ToArray();
if (!indexesArray.Any())
return source;
var start = 0;
var resultStringLength = source.Length - indexesArray.Length * extraction.Length;
var builder = new StringBuilder(resultStringLength);
foreach (var index in indexes)
{
builder.Append(source.Substring(start, index - start));
start = index + extraction.Length;
}
builder.Append(source.Substring(start));
return builder.ToString();
});
}
示例2: InsertStringAfter
internal InsertStringAfter(InsertString insertString, string marker)
{
_insertString = insertString;
_marker = marker;
_ignoreCase = false;
_position = The.Beginning;
}
示例3: RemoveStringToFirstOccurrence
internal RemoveStringToFirstOccurrence(RemoveString removeString, string marker)
{
_removeString = removeString;
_marker = marker;
_ignoreCase = false;
_position = The.Beginning;
}
示例4: RemoveValue
internal RemoveValue(string source, string extraction)
{
_source = source;
_extraction = extraction;
_ignoreCase = false;
_position = The.Beginning;
}
示例5: RemoveStringStartingOccurrencePosition
internal RemoveStringStartingOccurrencePosition(RemoveString removeString, The position, int occurrenceCount, string marker)
{
_removeString = removeString;
_position = position;
_occurrenceCount = occurrenceCount;
_marker = marker;
}
示例6: RemoveStringStartingOccurrenceToOccurrencePosition
internal RemoveStringStartingOccurrenceToOccurrencePosition(RemoveStringStartingOccurrence source, The position, int occurrenceCount, string marker)
{
_source = source;
_position = position;
_occurrenceCount = occurrenceCount;
_marker = marker;
}
开发者ID:AlexShkor,项目名称:FluentStrings,代码行数:7,代码来源:RemoveStringStartingOccurrenceToOccurrencePosition.cs
示例7: RemoveStringStartingOccurrence
internal RemoveStringStartingOccurrence(RemoveString removeString, int occurrenceCount, string marker)
{
_removeString = removeString;
_occurrenceCount = occurrenceCount;
_marker = marker;
_ignoreCase = false;
_position = The.Beginning;
}
示例8: RemoveValues
internal RemoveValues(string source, int quantity, string extraction)
{
_source = source;
_quantity = quantity;
_extraction = extraction;
_ignoreCase = false;
_position = The.Beginning;
}
示例9: InsertStringBeforeOccurrence
internal InsertStringBeforeOccurrence(InsertString insertString, int occurrenceCount, string marker)
{
_insertString = insertString;
_occurrenceCount = occurrenceCount;
_marker = marker;
_ignoreCase = false;
_position = The.Beginning;
}
示例10: RemoveStringStartingFirstOccurrencePosition
internal RemoveStringStartingFirstOccurrencePosition(RemoveString removeString, The position, string marker)
{
_removeString = removeString;
_position = position;
_marker = marker;
_ignoreCase = false;
_from = The.Beginning;
}
示例11: RemoveStringStartingOccurrencePositionToOccurrence
internal RemoveStringStartingOccurrencePositionToOccurrence(RemoveStringStartingOccurrencePosition removeStringStartingOccurrencePosition, int occurrence, string marker)
{
_removeStringStartingOccurrencePosition = removeStringStartingOccurrencePosition;
_occurrence = occurrence;
_marker = marker;
_ignoreCase = false;
_position = The.Beginning;
}
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:8,代码来源:RemoveStringStartingOccurrencePositionToOccurrence.cs
示例12: RemoveStringToOccurrencePosition
internal RemoveStringToOccurrencePosition(RemoveString removeString, The position, int occurrence, string marker)
{
_removeString = removeString;
_position = position;
_occurrenceCount = occurrence;
_marker = marker;
_ignoreCase = false;
_from = The.Beginning;
}
示例13: IndexOf
public static int? IndexOf(this string source, The position, int occurrenceCount, string marker, bool ignoreCase, The from)
{
var index = source.IndexOf(occurrenceCount, marker, ignoreCase, from);
if (index == null)
return null;
int shift = position == The.StartOf ? 0 : marker.Length;
return index.Value + shift;
}
示例14: RemoveValues
public static string RemoveValues(this string source, int? quantity, string extraction, StringComparison comparisonRule, The position)
{
switch (position)
{
case The.Beginning:
case The.End:
return RemoveValuesInternal(source, quantity, extraction, comparisonRule, position);
case The.StartOf:
case The.EndOf:
default:
throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by Remove().From() method");
}
}
示例15: IndexesOf
public static IEnumerable<int> IndexesOf(this string source, string marker, bool ignoreCase, The position)
{
switch (position)
{
case The.Beginning:
return source.IndexesOf(marker, ignoreCase);
case The.End:
return source.IndexesOf(marker, ignoreCase).Reverse();
case The.StartOf:
case The.EndOf:
default:
throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by IndexesOf().From() method");
}
}