a- package fmi110;
- public class Test2 {
- public static void main(String[] args) {
- tranFisrtLetter("hello");
-
- }
- public static void tranFisrtLetter(String str){//将字符串首字母编程大写
- String firstLetter = str.substring(0,1);//获取首字母字符串
- System.out.println(firstLetter.toUpperCase() + str.substring(1));
- }
- }
复制代码
|
|