BestPractice – Transform first character of a string into lower case

I would use simple concatenation:

Char.ToLowerInvariant(name[0]) + name.Substring(1)

The first solution is not optimized because string.Format is slow and you don’t need it if you have a format that will never change. It also generates an extra string to covert the letter to lowercase, which is not needed.

The approach with “+ 32” is ugly / not maintainable as it requires knowledge of ASCII character value offsets. It will also generate incorrect output with Unicode data and ASCII symbol characters.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)