本文整理汇总了C#中StripableText.FixCasing方法的典型用法代码示例。如果您正苦于以下问题:C# StripableText.FixCasing方法的具体用法?C# StripableText.FixCasing怎么用?C# StripableText.FixCasing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StripableText
的用法示例。
在下文中一共展示了StripableText.FixCasing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratePreview
private void GeneratePreview()
{
Cursor = Cursors.WaitCursor;
listViewFixes.BeginUpdate();
listViewFixes.Items.Clear();
foreach (Paragraph p in _subtitle.Paragraphs)
{
string text = p.Text;
foreach (ListViewItem item in listViewNames.Items)
{
string name = item.SubItems[1].Text;
string textNoTags = HtmlUtil.RemoveHtmlTags(text);
if (textNoTags != textNoTags.ToUpper())
{
if (item.Checked && text != null && text.Contains(name, StringComparison.OrdinalIgnoreCase) && name.Length > 1 && name != name.ToLower())
{
var st = new StripableText(text);
st.FixCasing(new List<string> { name }, true, false, false, string.Empty);
text = st.MergedString;
}
}
}
if (text != p.Text)
AddToPreviewListView(p, text);
}
listViewFixes.EndUpdate();
groupBoxLinesFound.Text = string.Format(Configuration.Settings.Language.ChangeCasingNames.LinesFoundX, listViewFixes.Items.Count);
Cursor = Cursors.Default;
}
示例2: FixCasing
private string FixCasing(string text, string lastLine, List<string> namesEtc)
{
string original = text;
if (radioButtonNormal.Checked)
{
if (checkBoxOnlyAllUpper.Checked && text != text.ToUpper())
return text;
if (text.Length > 1)
{
// first all to lower
text = text.ToLower().Trim();
text = text.FixExtraSpaces();
var st = new StripableText(text);
st.FixCasing(namesEtc, false, true, true, lastLine); // fix all casing but names (that's a seperate option)
text = st.MergedString;
}
}
else if (radioButtonUppercase.Checked)
{
var st = new StripableText(text);
text = st.Pre + st.StrippedText.ToUpper() + st.Post;
text = HtmlUtil.FixUpperTags(text); // tags inside text
}
else if (radioButtonLowercase.Checked)
{
text = text.ToLower();
}
if (original != text)
_noOfLinesChanged++;
return text;
}