is String a Alpha String - Android java.lang

Android examples for java.lang:String Contains

Description

is String a Alpha String

Demo Code


//package com.java2s;

public class Main {
    public static boolean isAlphaString(String s) {
        boolean b = true;
        for (int i = 0; i < s.length(); i++) {
            if (!isAlpha(s.charAt(i))) {
                b = false;// ww w .  jav a 2  s. c o m
                break;
            }
        }
        return b;
    }

    public static boolean isAlpha(char c) {
        return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
    }
}

Related Tutorials