How about putting this in a function?
String[] parts = name.Split(" ");
StringBuilder sb - new StringBuilder();
for ( int i = 0 ; i <= parts.Length - 1; i++)
{
sb.Append(String.Format("[0][1] ",
parts[i].Substring(1,1).toUpper() + parts[i].Substring(2)));
}
return sb.ToString().Trim();
I didn't actually try this so you may need to tweak it a little, but
this should work.
On 4/15/05, balaji ranganathan <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi all
>
> Is any functions exists to get proper case, That means for example i'm
> having data like " balaji ranganathan " in database. i want to update this
> like " Balaji Ranganathan ". And in C# how can i get first letter as
> uppercase. i got the below code from Google, But i didn't get the proper
> output.
>
> private string MakeFirstUpperMakePascalCase( string name )
> {
> if ( name.Length <= 1) return name.ToUpper();
>
> Char[] letters = name.ToCharArray();
> letters[0] = Char.ToUpper( letters[0] );
> return new string( letters );
> }
>
> if i found solution for this i think getting propercase will be easy
>
> Thanks & Regards
> Bala
>
>
> ________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
>
>
>
> ________________________________
> Yahoo! Mail Mobile
> Take Yahoo! Mail with you! Check email on your mobile phone.
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/Microsofts_C_Sharp/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Microsofts_C_Sharp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/