sde
Centurion
what is the best way to make the first letter of a string upper case?
Dim strMyName As String = "paul"
Dim strFirstLetter As String = Microsoft.VisualBasic.UCase(Microsoft.VisualBasic.Left(strMyName, 1))
strMyName = strFirstLetter & Microsoft.VisualBasic.Mid(strMyName, 2, Microsoft.VisualBasic.Len(strMyName) - 1)
MessageBox.Show(strMyName)
'create a new string builder
Dim sb As New System.Text.StringBuilder("some text")
'replace the first letter with its uppercase counterpart
sb = sb.Replace(sb.Chars(0), Char.ToUpper(sb.Chars(0)), 0, 1)
MessageBox.Show(sb.ToString)
private string UCFirst(string strName)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(strName);
sb = sb.Replace(sb[0], Char.ToUpper(sb[0]), 0, 1);
return sb.ToString();
}