Javascript
function capitalize(s)
{
return s[0].toUpperCase() + s.slice(1);
}
C#
public static string FirstCharToUpper(string s)
{
// Check for empty string.
if (string.IsNullOrEmpty(s))
{
return string.Empty;
}
// Return char and concat substring.
return char.ToUpper(s[0]) + s.Substring(1);
}
No hay comentarios:
Publicar un comentario