
org.openrdf.util.ASCIIUtil Maven / Gradle / Ivy
The newest version!
/* Sesame - Storage and Querying architecture for RDF and RDF Schema
* Copyright (C) 2001-2006 Aduna
*
* Contact:
* Aduna
* Prinses Julianaplein 14 b
* 3817 CS Amersfoort
* The Netherlands
* tel. +33 (0)33 465 99 87
* fax. +33 (0)33 465 99 87
*
* http://aduna-software.com/
* http://www.openrdf.org/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openrdf.util;
/**
* Utility methods for ASCII character checking.
**/
public class ASCIIUtil {
/*------------------------------------------------------+
| Methods |
+------------------------------------------------------*/
/**
* Checks whether the supplied character is a letter or number.
* @see #isLetter
* @see #isNumber
**/
public static boolean isLetterOrNumber(int c) {
return isLetter(c) || isNumber(c);
}
/**
* Checks whether the supplied character is a letter.
**/
public static boolean isLetter(int c) {
return isUpperCaseLetter(c) || isLowerCaseLetter(c);
}
/**
* Checks whether the supplied character is an upper-case letter.
**/
public static boolean isUpperCaseLetter(int c) {
return (c >= 65 && c <= 90); // A - Z
}
/**
* Checks whether the supplied character is an lower-case letter.
**/
public static boolean isLowerCaseLetter(int c) {
return (c >= 97 && c <= 122); // a - z
}
/**
* Checks whether the supplied character is a number
**/
public static boolean isNumber(int c) {
return (c >= 48 && c <= 57); // 0 - 9
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy