zoukankan      html  css  js  c++  java
  • 统计字母个数

    假设有字符串“uyde87dw3n8AU7au9”,统计其中数字的个数

    package zix;
    
    public class Xx {
    	public static void main(String[] args) {
    		String str="uyde87dw3n8AU7au9";
    		String[] str1=new String[str.length()];
    		int num=0;
    		for(int i=0;i<str1.length;i++){
    			if(str.charAt(i)>='0' && (str.charAt(i))<='9'){
    				num++;
    			}
    		}
    		System.out.println("数字个数:"+num);
    	}
    }
    

    运行结果:

  • 相关阅读:
    hdoj:2075
    hdoj:2072
    hdoj:2071
    hdoj:2070
    hdoj:2069
    test001
    hdoj:2067
    hdoj:2061
    hdoj:2058
    hdoj:2057
  • 原文地址:https://www.cnblogs.com/zyn0216/p/7613014.html
Copyright © 2011-2022 走看看