Java String Length Get lengthIfAllAlpha(String str)

Here you can find the source of lengthIfAllAlpha(String str)

Description

length If All Alpha

License

Creative Commons License

Declaration

private static int lengthIfAllAlpha(String str) 

Method Source Code

//package com.java2s;

public class Main {
    private static int lengthIfAllAlpha(String str) {
        int len = (str == null) ? 0 : str.length();
        for (int i = 0; i < len; ++i) {
            char c1 = str.charAt(i);
            if (!((c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z'))) {
                return 0;
            }//  w ww . j ava 2s . co m
        }
        return len;
    }
}

Related

  1. LengthConversionFactor(String OldUnits)
  2. lengthExpandedTabs(String string, int toIdx, int tabWidth)
  3. lengthExpression(final String operand, final long length)
  4. lengthField(String propertyName)
  5. lengthFormat(String str, int maxLength)
  6. lengthIntegers(String str)
  7. lengthMinusColors(String thisStr)
  8. lengthMinusTrailingWhitespace(String line)
  9. lengthOfCommonPrefix(String s1, String s2)