java 怎么实现:This is Hello World!--> World Hello is This
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/19 14:17:29
java 怎么实现:This is Hello World!--> World Hello is This
如题,前面没空格
如题,前面没空格
public class Test {
public static void main(String[] args) {
String str = "This is Hello World!";
String str1 = str.substring(0, str.length() - 1);// 去掉标点符号
String[] strs = str1.split(" ");// 将去掉标点符号后的字符串进行拆分
StringBuffer sb = new StringBuffer(str.substring(str.length() - 1));// 创建带最后一个标点符号的stringBuffer类
for (int i = strs.length - 1; i >= 0; i--) {
sb.append(strs[i]).append(" ");// 打印一个word并加上一个空格
}
String result = sb.substring(0, sb.length() - 1);// 去掉最后一个空格
System.out.println(result);
}
}
public static void main(String[] args) {
String str = "This is Hello World!";
String str1 = str.substring(0, str.length() - 1);// 去掉标点符号
String[] strs = str1.split(" ");// 将去掉标点符号后的字符串进行拆分
StringBuffer sb = new StringBuffer(str.substring(str.length() - 1));// 创建带最后一个标点符号的stringBuffer类
for (int i = strs.length - 1; i >= 0; i--) {
sb.append(strs[i]).append(" ");// 打印一个word并加上一个空格
}
String result = sb.substring(0, sb.length() - 1);// 去掉最后一个空格
System.out.println(result);
}
}
java 怎么实现:This is Hello World!--> World Hello is This
hello ----- hello this is maria
- HEllo,this is 8325788.- (
hello,this is Sue ()
hello,this is Bob speaking!怎么翻译
hello world 怎么读?
Hello!This is Tom s_____.
hello , this is 86563258. ( )?
Hello.This is Silkroad Online.
Tom:Hello,this is Tom.
Hello!This is John_(speak)
-Hello this is 8325788.-___?