本文整理汇总了C#中System.Globalization.CultureInfo.ToTitleCase方法的典型用法代码示例。如果您正苦于以下问题:C# System.Globalization.CultureInfo.ToTitleCase方法的具体用法?C# System.Globalization.CultureInfo.ToTitleCase怎么用?C# System.Globalization.CultureInfo.ToTitleCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.CultureInfo
的用法示例。
在下文中一共展示了System.Globalization.CultureInfo.ToTitleCase方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: list_spells_SelectedIndexChanged
private void list_spells_SelectedIndexChanged(object sender, EventArgs e)
{
spell = MageSpellList.spell_list[cb_spell_order.SelectedIndex][list_spells.SelectedIndex];
System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo;
lbl_spell_name.Text = spell.name;
lbl_spell_duration.Text = String.Format("Duration: {0}", spell.duration);
lbl_spell_cost.Text = String.Format("Cost: {0}", spell.cost.ToString());
lbl_spell_covert.Text = (spell.vulgar == true) ? "Vulgar" : "Covert";
lbl_spell_action.Text = (spell.extended == true) ? "Extended" : "Instant";
lbl_spell_dp.Text = String.Format("Dicepool:\n{0} + {1} + {2}\nTotal: {3}",
cap.ToTitleCase(spell.attribute), cap.ToTitleCase(spell.skill), Enum.GetName(typeof(Arcana), cb_spell_order.SelectedIndex),
(int)character.GetValue(spell.attribute) + character.skill_list[spell.skill.ToLower()].rank + character.mage.arcana[cb_spell_order.SelectedIndex]);
lbl_spell_description.Text = spell.desc;
}
示例2: ConvertToValidSharePointFieldName
public static string ConvertToValidSharePointFieldName(this string source)
{
System.Globalization.TextInfo UsaTextInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
string staticName = UsaTextInfo.ToTitleCase(source);
Regex regex = new Regex(@"\W");
return regex.Replace(staticName.DoStripDiacritics(), string.Empty);
}
示例3: SpellListing
public SpellListing(MageSpell spell, int x, int y, int dicepool = 0)
{
this.spell = spell;
this.x = x;
this.y = y;
System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo;
lbl_name = new Label();
lbl_name.SetBounds(this.x, this.y, width, height);
lbl_name.Text = spell.name;
lbl_dicepool = new Label();
lbl_dicepool.SetBounds(this.x, this.y+16, width, height);
lbl_dicepool.Text = String.Format("{0}+{1}+{2}: {3}", cap.ToTitleCase(spell.attribute), cap.ToTitleCase(spell.skill), Enum.GetName(typeof(Arcana), (int)spell.arcana), dicepool);
lbl_description = new Label();
lbl_description.SetBounds(this.x, this.y+32, desc_width, desc_height);
lbl_description.Text = spell.desc;
}
示例4: Main
static void Main(string[] args)
{
Console.WriteLine("running.....");
string allUserPath = GetAllUserPath();
ReadPathinLicenseFile(allUserPath);
if (_readLicenseFilesBylines.Count < 0)
{
return;
}
string executePath = _readLicenseFilesBylines[0];
string workingDirectory = Path.GetDirectoryName(_readLicenseFilesBylines[1]);
string xhtmlFile = _readLicenseFilesBylines[1];
string exportTitle = _readLicenseFilesBylines[2];
string creatorTool = _readLicenseFilesBylines[3];
string inputType = _readLicenseFilesBylines[4];
string commonTesting = _readLicenseFilesBylines[5];
string pdfFileName = string.Empty;
pdfFileName = ProcessLicensePdf(pdfFileName, executePath);
if (exportTitle == string.Empty)
exportTitle = "ExportPdf";
exportTitle = exportTitle.Replace(" ", "_") + ".pdf";
if (workingDirectory != null) exportTitle = Path.Combine(workingDirectory, exportTitle);
string licencePdfFile = pdfFileName.Replace(".pdf", "1.pdf");
ShowPDFFile(licencePdfFile, exportTitle, commonTesting, pdfFileName);
System.Globalization.TextInfo myTI = new System.Globalization.CultureInfo("en-US", false).TextInfo;
inputType = myTI.ToTitleCase(inputType);
if (creatorTool.ToLower() == "libreoffice")
{
Common.CleanupExportFolder(xhtmlFile, ".tmp,.de,.exe,.jar,.xml,.odt,.odm", "layout.css", string.Empty);
LoadParameters(inputType);
CreateRAMP(xhtmlFile, inputType);
Common.CleanupExportFolder(xhtmlFile, ".xhtml,.xml,.css", "layout.css", string.Empty);
}
if (creatorTool.ToLower().Contains("prince"))
{
string cleanExtn = ".tmp,.de,.exe,.jar,.xml";
Common.CleanupExportFolder(xhtmlFile, cleanExtn, "layout.css", string.Empty);
LoadParameters(inputType);
xhtmlFile = xhtmlFile.Replace(".pdf", ".xhtml");
if (File.Exists(xhtmlFile))
{
CreateRAMP(xhtmlFile, inputType);
cleanExtn = ".xhtml,.xml,.css";
Common.CleanupExportFolder(xhtmlFile, cleanExtn, "layout.css", string.Empty);
}
}
}
示例5: removeSpaces
/// <summary>
/// Remove the spaces and special characters from a string
/// </summary>
/// <param name="s">String to be edited</param>
/// <returns>String with characters removed</returns>
private static string removeSpaces(string s)
{
string result;
System.Globalization.TextInfo ti = new System.Globalization.CultureInfo("en-gb", false).TextInfo;
result = ti.ToTitleCase(s); // capitalise first letter of words
result = result.Replace(" ", string.Empty); // remove spaces
result = result.Replace(@"'", string.Empty); // remove single quote
result = result.Replace(@"`", string.Empty); // remove single quote
result = result.Replace(@",", string.Empty); // remove comma
result = result.Replace(@".", string.Empty); // remove period
return result;
}
示例6: AddColour
// Add a new colour
public string AddColour(string colourName)
{
if (string.IsNullOrEmpty(colourName))
{
return null;
}
else
{
// Optional, for your learning enjoyment
var fixer = new System.Globalization.CultureInfo("en-ca").TextInfo;
colourName = fixer.ToTitleCase(colourName);
// Add a new Colour object
this.Colours.Add(new Colour() { Id = this.Colours.Count + 1, ColourName = colourName });
// Save to application state
HttpContext.Current.Application["Colours"] = this.Colours;
return colourName;
}
}
示例7: Translate
public string Translate(string Message)
{
if (Message.Equals(null) || _translator.Equals(null))
return null;
var sb = new StringBuilder();
var tokens = _translator.Tokenize(Message);
var ci = new System.Globalization.CultureInfo("en-US").TextInfo;
foreach (var t in tokens)
{
if (!tokens.ElementAt(0).Equals(t))
sb.Append(_translator.Translate(t));
else
sb.Append(ci.ToTitleCase(_translator.Translate(t)));
sb.Append(" ");
}
return sb.ToString().TrimEnd();
}
示例8: setDicepool
public void setDicepool(int dicepool)
{
System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo;
lbl_dicepool.Text = String.Format("{0}+{1}+{2}: {3}", cap.ToTitleCase(spell.attribute), cap.ToTitleCase(spell.skill), Enum.GetName(typeof(Arcana), (int)spell.arcana), dicepool);
}
示例9: determineDinoRaceFromStats
private List<int> determineDinoRaceFromStats(float[] stats, string name)
{
List<int> possibleDinos = new List<int>();
// for wild dinos, we can get the name directly.
System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
name = textInfo.ToTitleCase(name.ToLower());
int sI = Values.V.speciesNames.IndexOf(name);
if (sI >= 0)
{
possibleDinos.Add(sI);
return possibleDinos;
}
double baseValue;
double incWild;
double possibleLevel;
bool possible;
for (int i = 0; i < Values.V.species.Count; i++)
{
possible = true;
// check that all stats are possible (no negative levels)
for (int s = 7; s >= 0; s--)
{
baseValue = Values.V.species[i].stats[s].BaseValue;
incWild = Values.V.species[i].stats[s].IncPerWildLevel;
if (incWild > 0)
{
//possibleLevel = ((statIOs[s].Input - Values.V.species[i].stats[s].AddWhenTamed) - baseValue) / (baseValue * incWild); // this fails if creature is wild
possibleLevel = (statIOs[s].Input - baseValue) / (baseValue * incWild);
if (possibleLevel < 0)
{
possible = false;
break;
}
}
}
if (!possible)
continue;
// check that torpor is integer
baseValue = Values.V.species[i].stats[7].BaseValue;
incWild = Values.V.species[i].stats[7].IncPerWildLevel;
possibleLevel = ((statIOs[7].Input - Values.V.species[i].stats[7].AddWhenTamed) - baseValue) / (baseValue * incWild);
double possibleLevelWild = (statIOs[7].Input - baseValue) / (baseValue * incWild);
if (possibleLevelWild < 0 || Math.Round(possibleLevel, 3) > (double)numericUpDownLevel.Value - 1 || (Math.Round(possibleLevel, 3) % 1 > 0.001 && Math.Round(possibleLevelWild, 3) % 1 > 0.001))
continue;
bool likely = true;
// food and oxygen are stats that are unlikely to be levelled for most dinos, so let's order the possibilities with those first
/*
baseValue = Stats.statValue(i, 3).BaseValue;
incWild = Stats.statValue(i, 3).IncPerWildLevel;
possibleLevel = ((statIOs[3].Input - Stats.statValue(i, 3).AddWhenTamed) - baseValue) / (baseValue * incWild);
if (possibleLevel < 0 || possibleLevel > (double)numericUpDownLevel.Value - 1)
continue;
if (possibleLevel != (int)possibleLevel)
likely = false;
*/
// now oxygen
baseValue = Values.V.species[i].stats[4].BaseValue;
incWild = Values.V.species[i].stats[4].IncPerWildLevel;
possibleLevel = ((statIOs[4].Input - Values.V.species[i].stats[4].AddWhenTamed) - baseValue) / (baseValue * incWild);
if (possibleLevel < 0 || possibleLevel > (double)numericUpDownLevel.Value - 1)
continue;
if (Math.Round(possibleLevel, 3) != (int)possibleLevel || possibleLevel > (double)numericUpDownLevel.Value / 2)
likely = false;
if (statIOs[4].Input != 0 && baseValue == 0)
likely = false; // having an oxygen value for non-oxygen dino is a disqualifier
if (likely)
possibleDinos.Insert(0, i);
else
possibleDinos.Add(i);
}
return possibleDinos;
}
示例10: StandardizeMusic
/// <summary>
/// Converts "_" and "%20" to "". Also applies title case to file name.
/// </summary>
public string StandardizeMusic(string p_filePath)
{
string modedPath = p_filePath;
if (Path.GetExtension(modedPath) == ".mp3")
{
string fileDir = Path.GetDirectoryName(modedPath);
string fileName = Path.GetFileNameWithoutExtension(modedPath);
string newFileName = fileName.Replace("_", " ");
newFileName = newFileName.Replace("%20", " ");
System.Globalization.TextInfo myTI = new System.Globalization.CultureInfo("en-US", false).TextInfo;
newFileName = myTI.ToTitleCase(newFileName);
if (fileName != newFileName)
{
string newFilePath = Path.Combine(fileDir, newFileName) + ".mp3";
File.Move(modedPath, newFilePath);
thdMsg.Type = TMSType.Progress2;
thdMsg.Data2 = "Music: File Name Formatted";
if (Progress != null)
Progress(thdMsg);
}
}
return modedPath;
}
示例11: cb_mage_order_SelectedIndexChanged
private void cb_mage_order_SelectedIndexChanged(object sender, EventArgs e)
{
System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo;
MageOrder order = mage_order_list[cb_mage_order.SelectedIndex];
character.mage.order = order;
lbl_mage_order_spec.Text = String.Format("Rote Specialties\n{0}\n{1}\n{2}\n",
cap.ToTitleCase(order.skill1), cap.ToTitleCase(order.skill2), cap.ToTitleCase(order.skill3));
}
示例12: flush
public void flush(){
System.Console.WriteLine ("FLSH!!!!!!!!!");
string tag = this.obj.dicTag ["tag"];
System.Globalization.TextInfo tf = new System.Globalization.CultureInfo ("en-US", false).TextInfo;
string className = "Novel." + tf.ToTitleCase (tag) + "Component";
//Novel.Bg_removeComponent
//リフレクションで動的型付け
Debug.Log (className);
Type masterType = Type.GetType (className);
AbstractComponent cmp;
cmp = (AbstractComponent)Activator.CreateInstance (masterType);
this.obj.dicParamDefault = cmp.originalParam;
Dictionary<string,string> tmpDic = new Dictionary<string,string> ();
List<string> l = cmp.arrayVitalParam;
for (var i = 0; i < l.Count; i++) {
string vital = l [i];
tmpDic [vital] = "yes";
}
this.obj.dicParamVital = tmpDic;
//必須パラメータとかデフォルト値を取得
this.arrDoc.Add (this.obj);
this.obj = new DocObject ();
this.status = "";
}