private string ConvertToPascal(string strFileName)
{
if (strFileName == null) throw new ArgumentNullException("strException", "Null is not a valid string!");
if (strFileName.Length == 0) return strFileName;
string[] strWords = strFileName.Split(' ');
for (int i = 0; i < strWords.Length; i++)
{
if (strWords[i].Length > 0)
{
string strWord = strWords[i];
char strFirstLetter = char.ToUpper(strWord[0]);
strWords[i] = strFirstLetter + strWord.Substring(1);
}
}
return string.Join(" ", strWords);
}
No comments:
Post a Comment