views:

110

answers:

2

I'm currently trying to find an easy way to convert a Visual (Managed) C++ string to title case. In VB.NET, you can use either:

StrConv(sampleString, vbProperCase)

or

sampleString = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ToTitleCase(sampleString)

In C# you use:

sampleString = System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ToTitleCase(sampleString)

How do I do it in Visual C++? Is it something similar that I just can't seem to find?

+1  A: 

If you're talking about managed C++, you can use the same functions as in C#/VB.Net.

If you mean native C++, then:

  1. Pretty certain there's nothing of the sort in the language itself.
  2. AFAIK not in the Win32 API as well.
  3. Your best hope then is to find such a function in some library (I personally can't think of one).
Assaf Lavie
It is managed, but for some reason I intellisense only gives me a "get" function once I use "System::Globalization::CultureInfo::CurrentUICulture"
Sivvy
Found the answer at http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase(VS.71).aspxThey are the same, but it would seem my poor grasp of the language prevented me from getting it to work.
Sivvy
+1  A: 

Check the documentation on TextInfo.ToTitleCase it has examples for Managed C++

Ryan Rinaldi
I've already seen that. It only shows C# code.
Sivvy
Check your language filter on the top of the page. You might have MSDN set to only show you C# code.
Ryan Rinaldi