Determines if code point is a non character - Android Graphics

Android examples for Graphics:Path Point

Description

Determines if code point is a non character

Demo Code

/**//w ww.  j  a  v  a  2  s.c  o  m
 *******************************************************************************
 * Copyright (C) 1996-2004, International Business Machines Corporation and    *
 * others. All Rights Reserved.                                                *
 *******************************************************************************
 */
//package com.java2s;

public class Main {
    /**
     * Minimum suffix value that indicates if a character is non character.
     * Unicode 3.0 non characters
     */
    private static final int NON_CHARACTER_SUFFIX_MIN_3_0_ = 0xFFFE;
    /**
     * New minimum non character in Unicode 3.1
     */
    private static final int NON_CHARACTER_MIN_3_1_ = 0xFDD0;
    /**
     * New non character range in Unicode 3.1
     */
    private static final int NON_CHARACTER_MAX_3_1_ = 0xFDEF;

    /**
     * Determines if codepoint is a non character
     * @param ch codepoint
     * @return true if codepoint is a non character false otherwise
     */
    public static boolean isNonCharacter(int ch) {
        if ((ch & NON_CHARACTER_SUFFIX_MIN_3_0_) == NON_CHARACTER_SUFFIX_MIN_3_0_) {
            return true;
        }

        return ch >= NON_CHARACTER_MIN_3_1_ && ch <= NON_CHARACTER_MAX_3_1_;
    }
}

Related Tutorials