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

📄 panduan.java

📁 读取文件中的所有内容并判断相关内容的...。
💻 JAVA
字号:


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Panduan 
{
	public static void main(String[] args)throws IOException 
	{
		Panduan panduan=new Panduan();
		String value="";
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		value=(String)in.readLine();
	    panduan.pd(value);

	}

	public void pd(String str)
	{
		char[] ca=str.toCharArray();
		int daxie=0;
		int xiaoxie=0;
		int shuzi=0;
		int qita=0;
		for(int j=0;j<ca.length;j++)
		{
			if(ifDaxie(ca[j]))
			{
				daxie++;				
			}
			else
			{
				if(ifXiaoxie(ca[j]))
				{
					xiaoxie++;				
				}
				else
				{
					if(ifShuzi(ca[j]))
					{
						shuzi++;				
					}
					else
					{
						qita++;
					}
				}
			}
		}
		System.out.println("大写"+daxie+"个");
		System.out.println("小写"+xiaoxie+"个");
		System.out.println("数字"+shuzi+"个");
		System.out.println("其他"+qita+"个");
	}
	public boolean ifDaxie(char ch)
	{
		if(ch>='A'&&ch<='Z')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	public boolean ifXiaoxie(char ch)
	{
		if(ch>='a'&&ch<='z')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	public boolean ifShuzi(char ch)
	{
		if(ch>='0'&&ch<='9')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -