is string English ASCII - Android Internationalization

Android examples for Internationalization:English

Description

is string English ASCII

Demo Code

import android.text.TextPaint;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static boolean isEnglish(String charaString) {
        return charaString.matches("^[a-zA-Z]*");
    }/*from   w  ww  . j a  va2 s .  c om*/
    public static boolean isEnglishString(String str) {
        for (int i = str.length(); --i >= 0;) {
            if ((str.charAt(i) >= 'a' && str.charAt(i) <= 'z')
                    || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z')) {
                continue;
            } else
                return false;
        }
        return true;
    }
}

Related Tutorials