发布网友 发布时间:2024-10-23 18:30
共2个回答
热心网友 时间:5分钟前
public class A {
public static void main(String[] args) {
System.out.println(In());
}
public static String In(){
Scanner input = new Scanner(System.in);
System.out.println("pls input:");
String words =" "+ input.nextLine();
Pattern pattern = Pattern.compile("\\s+\\S+");
Matcher matcher = pattern.matcher(words);
StringBuilder sbu = new StringBuilder();
while(matcher.find()){
sbu.append(FirstToUp(matcher.group())).append(" ");
}
return sbu.toString();
}
public static String FirstToUp(String name){
if(name == null || "".equals(name))
return "";
String string = name.trim();
return string.substring(0, 1).toUpperCase()+string.substring(1);
}
}
热心网友 时间:4分钟前
你这是想实现个什么功能呢