BestPractice - Transform first character of a string into lower case

前端 未结 11 2012

I\'d like to have a method that transforms the first character of a string into lower case.

My approaches:

1.

public static string ReplaceFir         


        
11条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 12:09

    Mine is

    if (!string.IsNullOrEmpty (val) && val.Length > 0)
    {
        return val[0].ToString().ToLowerInvariant() + val.Remove (0,1);   
    }
    

提交回复
热议问题