• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# The类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



The类属于命名空间,在下文中一共展示了The类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
                });
        }
开发者ID:AlexShkor,项目名称:FluentStrings,代码行数:34,代码来源:CommonLogic.cs


示例2: InsertStringAfter

 internal InsertStringAfter(InsertString insertString, string marker)
 {
     _insertString = insertString;
     _marker = marker;
     _ignoreCase = false;
     _position = The.Beginning;
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:7,代码来源:InsertStringAfter.cs


示例3: RemoveStringToFirstOccurrence

 internal RemoveStringToFirstOccurrence(RemoveString removeString, string marker)
 {
     _removeString = removeString;
     _marker = marker;
     _ignoreCase = false;
     _position = The.Beginning;
 }
开发者ID:jkonecki,项目名称:FluentStrings,代码行数:7,代码来源:RemoveStringToFirstOccurrence.cs


示例4: RemoveValue

 internal RemoveValue(string source, string extraction)
 {
     _source = source;
     _extraction = extraction;
     _ignoreCase = false;
     _position = The.Beginning;
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:7,代码来源:RemoveValue.cs


示例5: RemoveStringStartingOccurrencePosition

 internal RemoveStringStartingOccurrencePosition(RemoveString removeString, The position, int occurrenceCount, string marker)
 {
     _removeString = removeString;
     _position = position;
     _occurrenceCount = occurrenceCount;
     _marker = marker;
 }
开发者ID:jorik041,项目名称:FluentStrings,代码行数:7,代码来源:RemoveStringStartingOccurrencePosition.cs


示例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;
 }
开发者ID:jkonecki,项目名称:FluentStrings,代码行数:8,代码来源:RemoveStringStartingOccurrence.cs


示例8: RemoveValues

 internal RemoveValues(string source, int quantity, string extraction)
 {
     _source = source;
     _quantity = quantity;
     _extraction = extraction;
     _ignoreCase = false;
     _position = The.Beginning;
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:8,代码来源:RemoveValues.cs


示例9: InsertStringBeforeOccurrence

 internal InsertStringBeforeOccurrence(InsertString insertString, int occurrenceCount, string marker)
 {
     _insertString = insertString;
     _occurrenceCount = occurrenceCount;
     _marker = marker;
     _ignoreCase = false;
     _position = The.Beginning;
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:8,代码来源:InsertStringBeforeOccurrence.cs


示例10: RemoveStringStartingFirstOccurrencePosition

 internal RemoveStringStartingFirstOccurrencePosition(RemoveString removeString, The position, string marker)
 {
     _removeString = removeString;
     _position = position;
     _marker = marker;
     _ignoreCase = false;
     _from = The.Beginning;
 }
开发者ID:jkonecki,项目名称:FluentStrings,代码行数:8,代码来源:RemoveStringStartingFirstOccurrencePosition.cs


示例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;
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:9,代码来源:RemoveStringToOccurrencePosition.cs


示例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;
        }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:10,代码来源:CommonLogic.cs


示例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");
     }
 }
开发者ID:AlexShkor,项目名称:FluentStrings,代码行数:13,代码来源:CommonLogic.cs


示例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");
     }
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:14,代码来源:CommonLogic.cs


示例16: IndexesOf

 public static IEnumerable<int> IndexesOf(this string source, string marker, StringComparison comparisonRule, The position)
 {
     switch (position)
     {
         case The.Beginning:
             return source.IndexesOf(marker, comparisonRule);
         case The.End:
             return source.LastIndexesOf(marker, comparisonRule);
         case The.StartOf:
         case The.EndOf:
         default:
             throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by IndexesOf().From() method");
     }
 }
开发者ID:AlexShkor,项目名称:FluentStrings,代码行数:14,代码来源:CommonLogic.cs


示例17: InsertWithChecks

        private static string InsertWithChecks(this string source, string insertion, string marker, bool ignoreCase, int occurrenceCount, The position, bool after)
        {
            if (occurrenceCount < 0)
                throw new ArgumentOutOfRangeException("occurrence", "Negative occurrence count is not supported");

            if (occurrenceCount == 0)
                return source;

            return source.Insert(insertion, marker,
                (s, i, m) =>
                {
                    var shift = after ? marker.Length : 0;
                    var indexes = s.IndexesOf(m, ignoreCase, position).Take(occurrenceCount).ToArray();
                    return indexes.Any() ? s.Insert(indexes.Last() + shift, i) : s;
                });
        }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:16,代码来源:CommonLogic.cs


示例18: RemoveStartingOrTo

 public static string RemoveStartingOrTo(this string source, string marker, bool ignoreCase, The from, bool isStarting)
 {
     switch (from)
     {
         case The.Beginning:
             return source.RemoveStartingOrTo(marker, ignoreCase, isStarting, fromBeginning: true);
         case The.End:
             return source.RemoveStartingOrTo(marker, ignoreCase, isStarting, fromBeginning: false);
         case The.StartOf:
         case The.EndOf:
         default:
             var methodName = isStarting ? "Starting" : "To";
             throw new ArgumentOutOfRangeException(
                 "position", "Only Beginning and End positions are supported by Remove().{0}().From() method".f(methodName));
     }
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:16,代码来源:CommonLogic.cs


示例19: Insert

 public static string Insert(
     this string source, string insertion, string marker, bool ignoreCase = false,
     The position = The.Beginning, int? occurrenceCount = null, bool after = false)
 {
     switch (position)
     {
         case The.Beginning:
         case The.End:
             return occurrenceCount != null
                 ? source.InsertWithChecks(insertion, marker, ignoreCase, occurrenceCount.Value, position, after)
                 : source.InsertWithChecks(insertion, marker, ignoreCase, position, after);
         case The.StartOf:
         case The.EndOf:
         default:
             throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by Insert().From() method");
     }
 }
开发者ID:JackWangCUMT,项目名称:FluentStrings,代码行数:17,代码来源:CommonLogic.cs


示例20: RemoveStartingOrToPosition

        public static string RemoveStartingOrToPosition(this string source, The position, int occurrenceCount, string marker, bool ignoreCase, The from, bool isStarting)
        {
            if (occurrenceCount < 0)
                throw new ArgumentOutOfRangeException("occurrenceCount", "Negative occurrence count is not supported");

            if (occurrenceCount == 0)
                return source;

            switch (position)
            {
                case The.StartOf:
                case The.EndOf:
                    break;
                case The.Beginning:
                case The.End:
                default:
                    throw new ArgumentOutOfRangeException("position", "Only StartOf and EndOf positions are supported by Remove().Starting() method");
            }

            return source.Remove(marker,
                (s, m) =>
                {
                    var indexes = source.IndexesOf(marker, ignoreCase, from).Skip(occurrenceCount - 1);

                    if (!indexes.Any())
                        return source;

                    int shift = position == The.StartOf ? 0 : marker.Length;
                    var index = indexes.First() + shift;

                    if (index >= source.Length)
                        return isStarting ? source : String.Empty;

                    return isStarting ? source.Substring(0, index) : source.Remove(0, index);
                },
                (s, m) =>
                {
                    return isStarting || position == The.EndOf ? null : String.Empty;
                });
        }
开发者ID:jorik041,项目名称:FluentStrings,代码行数:40,代码来源:CommonLogic.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Theme类代码示例发布时间:2022-05-24
下一篇:
C# TfsTeamProjectCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap