How to capitalize the first letter of text in a TextView in an Android Application

前端 未结 11 1758
孤街浪徒
孤街浪徒 2020-12-23 15:35

I\'m not referring to textInput, either. I mean that once you have static text in a TextView (populated from a Database call to user inputted data (that may not be Capitaliz

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 16:24

    StringBuilder sb = new StringBuilder(name);
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));  
    return sb.toString();
    

提交回复
热议问题