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


C# CultureInfo.ToTitleCase方法代码示例

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


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

示例1: SetupSpellBook_Load

        private void SetupSpellBook_Load(object sender, EventArgs e)
        {
            var ti = new CultureInfo("en-ZA", false).TextInfo;
            txtAddonAuthor.Text = ti.ToTitleCase(Environment.UserName);

            var machineName = new string(Environment.MachineName.Where(char.IsLetter).ToArray()).ToLower();
            txtAddonName.Text = ti.ToTitleCase(machineName);

            txtAddonAuthor.Text = SpellBook.AddonAuthor;
            txtAddonName.Text = ConfigFile.ReadValue("PixelMagic", "AddonName");

            cmbKeyBind.DataSource = Enum.GetNames(typeof(WoW.Keys));

            try
            {
                var intVer = SpellBook.InterfaceVersion.Replace("\n", "").Replace("\r", "");

                foreach (var item in cmbWowVersion.Items)
                {
                    if (item.ToString().Contains(intVer)) cmbWowVersion.SelectedItem = item;
                }
            }
            catch(Exception ex)
            {
                // Do nothing - ignore
            }
            
            dgSpells.DataSource = SpellBook.dtSpells;
            dgAuras.DataSource = SpellBook.dtAuras;
        }
开发者ID:Xcesius,项目名称:PixelMagic-OpenSource,代码行数:30,代码来源:SetupSpellBook.cs

示例2: WordView

        public WordView(CGRect frame, string title, string value)
        {
            Init();
            Frame = frame;

            var textInfo = new CultureInfo("en-US",false).TextInfo;

            title = textInfo.ToTitleCase(title);
            value = textInfo.ToTitleCase(value);

            //Title label
            _title = new UILabel(new CGRect(0, 45, frame.Width, 50))
            {
                TextAlignment = UITextAlignment.Center,
                TextColor = "3C3C3C".ToUIColor(),
                Font = UIFont.FromName("Raleway-SemiBold", 32),
                Text = title
            };
            Add(_title);

            //Word label
            _word = new UILabel(new CGRect(0, 108, frame.Width, 59))
            {
                TextAlignment = UITextAlignment.Center,
                TextColor = "3C3C3C".ToUIColor(),
                Font = UIFont.FromName("Raleway-Regular", 32),
                Text = value
            };
            Add(_word);
        }
开发者ID:TsukishirOSan,项目名称:Language-Spelling,代码行数:30,代码来源:WordView.cs

示例3: AjaxAction

        public ActionResult AjaxAction(string nome, string sobrenome)
        {
            Thread.Sleep(3000);
            var ti = new CultureInfo("pt-BR").TextInfo;
            var nomeFormatado = string.Format("{0} {1}", ti.ToTitleCase(nome), ti.ToTitleCase(sobrenome));

            return PartialView("PartialNomes", nomeFormatado);
        }
开发者ID:vquaiato,项目名称:ajaxhelpersamples,代码行数:8,代码来源:HomeController.cs

示例4: TitleCase

	public void TitleCase ()
	{
		TextInfo ti = new CultureInfo ("en-US", false).TextInfo;

		Assert.AreEqual (" The Dog", ti.ToTitleCase (" the dog"));
		Assert.AreEqual (" The Dude", ti.ToTitleCase (" The Dude"));
		Assert.AreEqual ("La Guerra Yla Paz", ti.ToTitleCase ("la Guerra yLa pAz"));
		Assert.AreEqual ("\tTab\tAnd\tPeace", ti.ToTitleCase ("\ttab\taNd\tpeaCE"));
	}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:TextInfoTest.cs

示例5: TitleCase

	public void TitleCase ()
	{
		TextInfo ti = new CultureInfo ("en-US", false).TextInfo;

		Assert.AreEqual (" The Dog", ti.ToTitleCase (" the dog"), "#1");
		Assert.AreEqual (" The Dude", ti.ToTitleCase (" The Dude"), "#2");
		Assert.AreEqual ("La Guerra Yla Paz", ti.ToTitleCase ("la Guerra yLa pAz"), "#3");
		Assert.AreEqual ("\tTab\tAnd\tPeace", ti.ToTitleCase ("\ttab\taNd\tpeaCE"), "#4");
		Assert.AreEqual ("This_Is\uFE58A\u0095String\u06D4With\uFE33Separators", ti.ToTitleCase ("this_is\uFE58a\u0095string\u06D4with\uFE33separators"), "#5");
	}
开发者ID:sushihangover,项目名称:playscript,代码行数:10,代码来源:TextInfoTest.cs

示例6: ActorNameGenerator

        static ActorNameGenerator()
        {
            TextInfo myTI = new CultureInfo("en-gb", false).TextInfo;

            //Load everything
            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "FemaleNames.txt"))
            {
                femaleHuman.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "MaleNames.txt"))
            {
                maleHuman.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "Surnames.txt"))
            {
                humanSurname.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "FirstName.txt"))
            {
                orcName.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "SurnameAft.txt"))
            {
                orcSurnameAft.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "SurnameFore.txt"))
            {
                orcSurnameFore.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            //Title case all of them
            for (int i = 0; i < femaleHuman.Count; i++)
            {
                femaleHuman[i] = myTI.ToTitleCase(femaleHuman[i]);
            }

            for (int i = 0; i < maleHuman.Count; i++)
            {
                maleHuman[i] = myTI.ToTitleCase(maleHuman[i]);
            }

            for (int i = 0; i < humanSurname.Count; i++)
            {
                humanSurname[i] = myTI.ToTitleCase(humanSurname[i]);
            }

            random = new Random();
        }
开发者ID:Haedrian,项目名称:Divine-Right,代码行数:53,代码来源:ActorNameGenerator.cs

示例7: Capitalize

 public static string Capitalize(this string original, bool onlyFirst=false, string culture="en-US")
 {
     TextInfo textInfo = new CultureInfo(culture, false).TextInfo;
     original = original.Trim();
     if (string.IsNullOrWhiteSpace(original))
         return null;
     if (onlyFirst && original.Length != 1)
     {
         return textInfo.ToTitleCase(original.Substring(0, 1)) + original.Substring(1);
     }
     else
     {
         return textInfo.ToTitleCase(original);
     }
 }
开发者ID:dioptre,项目名称:nkd,代码行数:15,代码来源:StringHelper.cs

示例8: Main

        static void Main(string[] args)
        {
            var syntaxTree = SyntaxTree.ParseFile("Person.cs");

            var allNodes = syntaxTree.GetRoot().DescendantNodes();

            var fields = allNodes.OfType<FieldDeclarationSyntax>().SelectMany(
                f => f.Declaration.Variables.Select(
                    v => v.Identifier.ValueText)).ToList();

            var methods = allNodes.OfType<MethodDeclarationSyntax>().Select(
                m => m.Identifier.ValueText);

            var textInfo = new CultureInfo("nb-NO").TextInfo;

            foreach (var field in fields)
            {
                var trimmedAndCapitalizedFieldName = textInfo.ToTitleCase(field.TrimStart('_'));

                var getterName = "Get" + trimmedAndCapitalizedFieldName;
                var setterName = "Set" + trimmedAndCapitalizedFieldName;

                if (methods.Contains(getterName))
                    Console.WriteLine("there seems to be a getter for field '{0}': {1}", field, getterName);

                if (methods.Contains(setterName))
                    Console.WriteLine("there seems to be a setter for field '{0}': {1}", field, setterName);
            }

            Console.Read();
        }
开发者ID:skasti,项目名称:RoslynFagdag,代码行数:31,代码来源:Program.cs

示例9: GetPrimePlatSellOrders

        public static async Task<long?> GetPrimePlatSellOrders(string primeName)
        {
            CacheEntry<long?> cacheItem;
            if (_marketCache.TryGetValue(primeName, out cacheItem))
            {
                if (!cacheItem.IsExpired(_expirationTimespan))
                {
                    return cacheItem.Value;
                }
            }

            var textInfo = new CultureInfo("en-US", false).TextInfo;

            var partName = textInfo.ToTitleCase(primeName.ToLower());

            if (_removeBPSuffixPhrases.Any(suffix => partName.EndsWith(suffix + " Blueprint")))
            {
                partName = partName.Replace(" Blueprint", "");
            }

            // Since Warframe.Market is still using the term Helmet instead of the new one, TODO: this might change
            partName = partName.Replace("Neuroptics", "Helmet");

            if (_fixedQueryStrings.ContainsKey(partName))
            {
                //Some of Warframe.Market's query strings are mangled (extra spaces, misspellings, words missing) fix them manually...
                partName = _fixedQueryStrings[partName];
            }

            string jsonData;
            using (var client = new WebClient())
            {
                var uri = new Uri(_baseUrl + Uri.EscapeDataString(partName));

                try
                {
                    jsonData = await client.DownloadStringTaskAsync(uri);

                    dynamic result = JsonConvert.DeserializeObject(jsonData);

                    // when the server responds anything that is not 200 (HTTP OK) don't bother doing something else
                    if (result.code != 200)
                    {
                        Debug.WriteLine($"Error with {partName}, Status Code: {result.code.Value}");
                        _marketCache[primeName] = new CacheEntry<long?>(null);
                        return null;
                    }

                    IEnumerable<dynamic> sellOrders = result.response.sell;
                    long? smallestPrice = sellOrders.Where(order => order.online_status).Min(order => order.price);

                    _marketCache[primeName] = new CacheEntry<long?>(smallestPrice);
                    return smallestPrice;
                }
                catch
                {
                    return null;
                }
            }            
        }
开发者ID:Xeio,项目名称:VoidRewardParser,代码行数:60,代码来源:PlatinumPrices.cs

示例10: MIFieldValue

        public MIFieldValue(string field, string value, string prefix)
        {
            Value = value;
            TextInfo ti = new CultureInfo("en-US", false).TextInfo;
            string tempName = string.Empty;

            foreach (char c in field)
            {
                if (Char.IsLetterOrDigit(c))
                {
                    tempName += c;
                }
                else if (c == '(' || c == ')')
                {
                    continue;
                }
                else
                {
                    tempName += " ";
                }
            }
            tempName = ti.ToTitleCase(tempName.Trim()).Replace(" ", "");
            FieldWithoutPadding = string.Format("{0}_{1}", prefix, tempName);
            Field = string.Format("{0}{1}{2}", paddingChar, FieldWithoutPadding, paddingChar);
        }
开发者ID:viwhi1,项目名称:TDMaker,代码行数:25,代码来源:TemplateItem.cs

示例11: GetMonthsListForDropDown

        public IEnumerable<SelectListItem> GetMonthsListForDropDown()
        {
            var textInfo = new CultureInfo("en-US", false).TextInfo;
            var items = new List<SelectListItem>();
            //var selFirstListItem = new SelectListItem { Value = "", Text = "--- Choose ---" };
            //items.Add(selFirstListItem);

            var selItems = new List<SelectListItem>();
            if (DateTimeFormatInfo
                .CurrentInfo != null)
            {
                selItems = DateTimeFormatInfo
                    .CurrentInfo
                    .MonthNames
                    .Select((monthName, index) =>
                        new SelectListItem
                        {
                            Value = (index + 1).ToString(CultureInfo.InvariantCulture),
                            Text = textInfo.ToTitleCase(monthName)
                        }).Where(p => p.Text != "").ToList();

            }
            selItems = DateTimeFormatInfo
            .InvariantInfo
            .MonthNames
            .Select((monthName, index) =>
                new SelectListItem
                {
                    Value = (index + 1).ToString(CultureInfo.InvariantCulture),
                    Text = monthName
                }).Where(p => p.Text != "").ToList();

            items.AddRange(selItems);
            return items;
        }
开发者ID:brankobauk,项目名称:G3SpiritReports,代码行数:35,代码来源:DropDownHelper.cs

示例12: ConvertToTitleCase

        public string ConvertToTitleCase(string title)
        {
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            title = textInfo.ToTitleCase(title);

            return title;
        }
开发者ID:bontobuy,项目名称:BontoBuy.Web,代码行数:7,代码来源:Helper.cs

示例13: Start

	// Use this for initialization
	void Start () {

		if (string.IsNullOrEmpty(JumpToLevel)) {
			logger.LogError("Level", "Naming Error");
		}
		System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
		JumpToLevel = textInfo.ToTitleCase(JumpToLevel);
	}
开发者ID:ParkinT,项目名称:alcheme,代码行数:9,代码来源:LevelTeleport.cs

示例14: SetCase

        private static string SetCase(this string InputText)
        {
            TextInfo _textInfo = new CultureInfo(CultureInfo.CurrentCulture.ToString(), false).TextInfo;

            string _output = _textInfo.ToTitleCase(InputText.ToLower());

            return _output;
        }
开发者ID:exxoff,项目名称:AceMoneyImport,代码行数:8,代码来源:StringExtensions.cs

示例15: ToTitleCase

        private static string ToTitleCase(string texto, bool manterOqueJaEstiverMaiusculo)
        {
            texto = texto.Trim();

            if (!manterOqueJaEstiverMaiusculo) texto = texto.ToLower();

            TextInfo textInfo = new CultureInfo("pt-BR", false).TextInfo;
            return textInfo.ToTitleCase(texto);
        }
开发者ID:lhlima,项目名称:UnimedBrasil,代码行数:9,代码来源:TextoHelper.cs


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