Create the ToTitle method with the following code.
public static string ToTitle(string data)
{
if (!string.IsNullOrEmpty(data))
{
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
return string.Format(textInfo.ToTitleCase(data.ToLower()));
}
return data;
}
Now use this method on any page to convert any string into Title case.
string msg = "title test string";
Console.WriteLine(msg.ToTitle());
public static string ToTitle(string data)
{
if (!string.IsNullOrEmpty(data))
{
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
return string.Format(textInfo.ToTitleCase(data.ToLower()));
}
return data;
}
Now use this method on any page to convert any string into Title case.
string msg = "title test string";
Console.WriteLine(msg.ToTitle());
This comment has been removed by the author.
ReplyDeleteAmazing Blog.. Thanks for sharing great information about Xamarin.
ReplyDeleteHire Xamarin Developer
Yeah thank you
ReplyDelete