我很困惑为什么我的代码没有大写我的第一个字母,我从数据库中得到用户的名字,所有字母都是小写的。
这是代码:
String email = null;
String name = null;
StringBuilder nameSB = new StringBuilder();
nameSB.append(name);
nameSB.setCharAt(0, Character.toUpperCase(nameSB.charAt(0)));
name = nameSB.toString();
try {
email = ((User) ParseUser.getCurrentUser()).getEmail();
name = ((User) ParseUser.getCurrentUser()).getFirstName() + " " + ((User) ParseUser.getCurrentUser()).getLastName();
} catch (NullPointerException npe) {
}
答案 0 :(得分:0)
只是总结为答案
String email = null;
String name = null;
StringBuilder nameSB = new StringBuilder();
try {
email = ((User) ParseUser.getCurrentUser()).getEmail();
name = ((User) ParseUser.getCurrentUser()).getFirstName() + " " + ((User) ParseUser.getCurrentUser()).getLastName();
nameSB.append(name);
nameSB.setCharAt(0, Character.toUpperCase(nameSB.charAt(0)));
name = nameSB.toString();
} catch (NullPointerException npe) {
}