001package com.hfg.util; 002 003//------------------------------------------------------------------------------ 004/** 005 * General character utility functions. 006 * 007 * @author J. Alex Taylor, hairyfatguy.com 008 */ 009//------------------------------------------------------------------------------ 010// com.hfg XML/HTML Coding Library 011// 012// This library is free software; you can redistribute it and/or 013// modify it under the terms of the GNU Lesser General Public 014// License as published by the Free Software Foundation; either 015// version 2.1 of the License, or (at your option) any later version. 016// 017// This library is distributed in the hope that it will be useful, 018// but WITHOUT ANY WARRANTY; without even the implied warranty of 019// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 020// Lesser General Public License for more details. 021// 022// You should have received a copy of the GNU Lesser General Public 023// License along with this library; if not, write to the Free Software 024// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 025// 026// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 027// jataylor@hairyfatguy.com 028//------------------------------------------------------------------------------ 029 030public class CharUtil 031{ 032 033 //--------------------------------------------------------------------------- 034 /** 035 Returns whether the specified character is a unicode superscript character. 036 */ 037 public static boolean isSuperscript(char inChar) 038 { 039 return ((inChar >= '\u2070' && inChar <= '\u2071') // 0 or i 040 || inChar == '\u00B9' // 1 041 || inChar == '\u00B2' // 2 042 || inChar == '\u00B3' // 3 043 || (inChar >= '\u2074' && inChar <= '\u207F')); // 4 - n 044 } 045 046 //--------------------------------------------------------------------------- 047 /** 048 Returns whether the specified character is a unicode subscript character. 049 */ 050 public static boolean isSubscript(char inChar) 051 { 052 return ((inChar >= '\u2080' && inChar <= '\u208E') // 0 - ) 053 || (inChar >= '\u2090' && inChar <= '\u209C')); // a - t 054 } 055}