⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encrypt.java

📁 简单的文字处理,可以对输入的英文语句进行大小写变化,搜索所需要的英文字母在此句中出现的次数
💻 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 + -