![JAR search and dependency download from the Maven repository](/logo.png)
gov.nih.nlm.nls.lvg.Util.Char Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lvg2010dist Show documentation
Show all versions of lvg2010dist Show documentation
LVG tools is used by Apache cTAKES.
The newest version!
package gov.nih.nlm.nls.lvg.Util;
/*****************************************************************************
* This class represents character related methods.
*
* History:
*
* @author NLM NLS Development Team
*
* @version V-2010
****************************************************************************/
public class Char
{
// public methods
/**
* Check if a char is a puntuation. Punctuations include:
*
DASH_PUNCTUATION: -
* START_PUNCTUATION: ( { [
* END_PUNCTUATION: ) } ]
* CONNECTOR_PUNCTUATION: _
* OTHER_PUNCTUATION: !@#%&*\:;"',.?/
* MATH_SYMBOL: ~ + = | < >
* CURRENCY_SYMBOL: $
* MODIFIER_SYMBOL: ` ^
*
* @param inChar input chararter for checking if it is a punctuation
*
* @return true or false if the input character is or is not a punctuation
*/
public static boolean IsPunctuation(char inChar)
{
boolean isPunctuation = false;
int type = Character.getType(inChar);
// check if the input is a punctuation
if((type == Character.DASH_PUNCTUATION) // -
|| (type == Character.START_PUNCTUATION) // ( { [
|| (type == Character.END_PUNCTUATION) // ) } ]
|| (type == Character.CONNECTOR_PUNCTUATION) // _
|| (type == Character.OTHER_PUNCTUATION) // !@#%&*\:;"',.?/
|| (type == Character.MATH_SYMBOL) // ~ + = | < >
|| (type == Character.CURRENCY_SYMBOL) // $
|| (type == Character.MODIFIER_SYMBOL)) // ` ^
{
isPunctuation = true;
}
return isPunctuation;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy