Android String Char Get getCharNum(String str, char ch)

Here you can find the source of getCharNum(String str, char ch)

Description

get Char Num

Declaration

public static int getCharNum(String str, char ch) 

Method Source Code

//package com.java2s;

public class Main {

    public static int getCharNum(String str, char ch) {
        int num = 0;
        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) - ch == 0) {
                num++;//from w ww .  ja v a 2 s.  c o m
            }
        }
        return num;
    }
}

Related

  1. charAt(String str, int index)
  2. charSubString(String str, int charLen)
  3. getCharLength(String str)
  4. getFirstChar(String ch)
  5. isValidChar(String strInput)
  6. isAllCharDigit(String str)
  7. isAllWhitespace(CharSequence str)