📄 encrypt.java
字号:
import java.io.*;
class Encrypt {
public static void find (String lowsent, char n) {
int len=lowsent.length();
int t=0;
for (int i=0; i<len; i++) {
if (n==lowsent.charAt(i)) {
t++;
}
}
System.out.println("'"+n+"'"+" was found "+t+" times");
}
public static void main(String[] argv) {
System.out.print("Enter a sentence: ");
String sent=UserInput.readString();
System.out.println();
System.out.println("The sentence entered is: "+sent);
System.out.println("The sentence in uppercase is: "+sent.toUpperCase());
String lowsent=sent.toLowerCase();
System.out.println("The sentence in lowercase is: "+lowsent);
find(lowsent,'a');
find(lowsent,'e');
find(lowsent,'i');
find(lowsent,'o');
find(lowsent,'u');
String sent1=lowsent.replace('e','$');
String sent2=sent1.replace('s','!');
System.out.println(sent2);
} // end of main
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -