CultureInfo.CurrentCulture.TextInfo.ToTitleCase is gone?

Dumb question.
I cant seem to find ToTitleCase anywhere.

TextInfo textInfo =;
textInfo.ToTitleCase("this is a test");                 // doesnt exist

do i have to make my own method? I've seen people using it on xamarin before.


  • JOAOSerraJOAOSerra PTMember ✭✭

    Made my own

    private string ToTitleCase(string str)
                string auxStr = str.ToLower();
                string[] auxArr = auxStr.Split(' ');
                string result = "";
                bool firstWord = true;
                foreach (string word in auxArr)
                    if (!firstWord)
                        result += " ";
                        firstWord = false;
                    result += word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length-1);
                return result;
  • DanielLDanielL PLInsider ✭✭✭✭

    Try System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase

  • JOAOSerraJOAOSerra PTMember ✭✭

    that's what I was trying to use. It seems you can only use those in native projects. it does not exists in the PCL(?)

  • DanielLDanielL PLInsider ✭✭✭✭

    You're right! It seems that TextInfo.ToTitleCase is not available in PCL

Sign In or Register to comment.