Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

toTitleCase method missing?

Discussion in 'Scripting' started by yuriythebest, Dec 11, 2011.

  1. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,121
  2. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    Unity doesn't use .NET, but MONO, the open source port of .NET Framework.

    MONO 2.6 basically has the (approximate) feature set of .NET 3.0/3.5 minus Window Specific namespaces (i.e. no forms namespaces). But mono lags sometimes, so it's probably something to do with mono itself.

    If you use this to compare strings, you should rather use ToLower or ToUpper methods instead, as this is the preferred way of doing such string comparisons.

    Also as you may have checked out the comments, the ToTitleCase doesn't always result what users may expect and there is not even a guarantee it will stay the same in future. Imho this method was mainly added for ASP.NET, where you might want to format the title (hence the name of the method) of a page or news article, since it's typical to show article/news title with all words with uppercase.
     
  3. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,121
    Last edited: Dec 11, 2011
  4. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    That's actually not a title case you are scripting here. It is simply capitalizing the first letter of every word. True title case capitalizes the first letter only if it is an important word, omitting words such as "of," "the," "from" etc.