This works:
private string ToPascalCase(string input, char separator)
{
StringBuilder sb = new StringBuilder();
string[] parts = input.Split(separator);
foreach (string part in parts)
{
if (part.Length > 0)
{
sb.Append(Char.ToUpper(part[0]));
if (part.Length > 1)
sb.Append(part.Substring(1).ToLower());
}
sb.Append(separator);
}
sb.Remove(sb.Length - 1, 1);
return sb.ToString();
}
Might not be the best way of doing it though...
/claes
"sloan" <sl***@ipass.net> wrote in message
news:Ox**************@TK2MSFTNGP03.phx.gbl...
Ok, maybe thats not the best name for a method, but I'm looking for
something along the lines of ToUpper() or ToLower()
If I have an input like
john smith
or
johN smitH
..
Is there a way to cleanly make it
John Smith ?
Normally, space would be the delimeter, but knowing how to do it with any
delimiter would be cool too.
marY;jonEs
would be
Mary;Jones
Thanks for any ideas. I don't have the brainpower today to search. Aka,
I
need a memorial day weekend break.
..
-----------------------------
Sloan
http://spaces.msn.com/sholliday/