Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

charutils
java
lowercase
alphabet
communitycreator

What is CharUtils.isAsciiAlphaLower() in Java?

abhilash

isAsciiAlphaLower() is a static method of CharUtils class, that is used to check whether the input character is a lowercase alphabet or not.

How to import CharUtils

CharUtils is defined in the Apache Commons Lang package. Apache Commons Lang can be added to the Maven project by adding the following dependency to the pom.xml file.

<dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
</dependency>

For other versions of the commons-lang package, refer to the Maven Repository.

We can import the CharUtils class as follows.

import org.apache.commons.lang3.CharUtils;

Syntax

The syntax of the isAsciiAlphaLower() method is shown below.


public static boolean isAsciiAlphaLower(final char ch)

Parameters

The isAsciiAlphaLower() method accepts the following parameter:

  • final char ch: the character to check.

Return value

The isAsciiAlphaLower() method returns true if the character is a lowercase alphabet, i.e., the ASCIIAmerican Standard Code for Information Interchange value of the character is in the range of 6565 to 9090. Otherwise, it returns false.

Code

The code below shows how the isAsciiAlphaLower() method works in Java.

import org.apache.commons.lang3.CharUtils;

public class Main {

    public static void main(String[] args) {
        char c1 = 't';
        System.out.printf("The output of CharUtils.isAsciiAlphaLower() for the character '%s' is %s", c1, CharUtils.isAsciiAlphaLower(c1));
        System.out.println();

        c1 = 'È';
        System.out.printf("The output of CharUtils.isAsciiAlphaLower() for the character '%s' is %s", c1, CharUtils.isAsciiAlphaLower(c1));
        System.out.println();

        c1 = '9';
        System.out.printf("The output of CharUtils.isAsciiAlphaLower() for the character '%s' is %s", c1, CharUtils.isAsciiAlphaLower(c1));
        System.out.println();

        c1 = 'F';
        System.out.printf("The output of CharUtils.isAsciiAlphaLower() for the character '%s' is %s", c1, CharUtils.isAsciiAlphaLower(c1));
        System.out.println();
    }
}

Output

The code above produces the following output.


The output of CharUtils.isAsciiAlphaLower() for the character 't' is true
The output of CharUtils.isAsciiAlphaLower() for the character 'È' is false
The output of CharUtils.isAsciiAlphaLower() for the character '9' is false
The output of CharUtils.isAsciiAlphaLower() for the character 'F' is false

Explanation

  • character - 't'

    The isAsciiAlphaLower() method in line 77 returns true as the character is a lowercase alphabet.

  • character - 'È'

    The isAsciiAlphaLower() method in line 1111 returns false as the character is not a lowercase alphabet.

  • character - '9'

    The isAsciiAlphaLower() method in line 1515 returns false as the character is not a lowercase alphabet.

  • character - 'F'

    The isAsciiAlphaLower() method in line 1919 returns false as the character is not a lowercase alphabet.

RELATED TAGS

charutils
java
lowercase
alphabet
communitycreator
RELATED COURSES

View all Courses

Keep Exploring