package cn.itcaste.zyoye;
import java.util.Scanner;
/*
- 4.分析以下需求,并用代码实现:
(1)从键盘循环录入录入一个字符串,输入"end"表示结束
(2)将字符串中大写字母变成小写字母,小写字母变成大写字母,其它字符用"*"代替,并统计字母的个数
举例:
键盘录入:Hello12345World
输出结果:hELLO*****wORLD
总共10个字母
/
public class Demo2 {
public static void main(String[] args) {
String s=input();
System.out.println(s);
String a=fuction(s);
System.out.println(a);
}
public static String input(){
StringBuffer buffer=new StringBuffer();
System.out.println(“请输入你要转换的信息”);
Scanner c=new Scanner(System.in);
while(true){
String str=c.next();
if(str.endsWith(“end”)){
break;
}
else{
buffer=buffer.append(str);
}
}
return buffer.toStri