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


C# StripableText.CombineWithPrePost方法代码示例

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


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

示例1: Fix

 public void Fix(Subtitle subtitle, IFixCallbacks callbacks)
 {
     var language = Configuration.Settings.Language.FixCommonErrors;
     string fixAction = language.StartWithUppercaseLetterAfterPeriodInsideParagraph;
     int noOfFixes = 0;
     for (int i = 0; i < subtitle.Paragraphs.Count; i++)
     {
         Paragraph p = subtitle.Paragraphs[i];
         string oldText = p.Text;
         if (p.Text.Length > 3 && callbacks.AllowFix(p, fixAction))
         {
             var st = new StripableText(p.Text);
             string text = st.StrippedText;
             int start = text.IndexOfAny(ExpectedChars);
             while (start > 0 && start < text.Length)
             {
                 char charAtPosition = text[start];
                 // Allow fixing lowercase letter after recursive ??? or !!!.
                 if (charAtPosition != '.') // Dot is not include 'cause I don't capitalize word after the ellipses (...), right?
                 {
                     while (start + 1 < text.Length && text[start + 1] == charAtPosition)
                     {
                         start++;
                     }
                 }
                 if ((start + 3 < text.Length) && (text[start + 1] == ' ') && !IsAbbreviation(text, start, callbacks))
                 {
                     var subText = new StripableText(text.Substring(start + 2));
                     text = text.Substring(0, start + 2) + subText.CombineWithPrePost(ToUpperFirstLetter(subText.StrippedText, callbacks));
                 }
                 // Try to reach the last dot if char at *start is '.'.
                 if (charAtPosition == '.')
                 {
                     while (start + 1 < text.Length && text[start + 1] == '.')
                     {
                         start++;
                     }
                 }
                 start += 3;
                 if (start < text.Length)
                     start = text.IndexOfAny(ExpectedChars, start);
             }
             text = st.CombineWithPrePost(text);
             if (oldText != text)
             {
                 p.Text = text;
                 noOfFixes++;
                 callbacks.AddFixToListView(p, fixAction, oldText, p.Text);
             }
         }
     }
     callbacks.UpdateFixStatus(noOfFixes, language.StartWithUppercaseLetterAfterPeriodInsideParagraph, noOfFixes.ToString(CultureInfo.InvariantCulture));
 }
开发者ID:mgziminsky,项目名称:subtitleedit,代码行数:53,代码来源:FixStartWithUppercaseLetterAfterPeriodInsideParagraph.cs


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