Example usage for java.lang Character isValidCodePoint

List of usage examples for java.lang Character isValidCodePoint

Introduction

In this page you can find the example usage for java.lang Character isValidCodePoint.

Prototype

public static boolean isValidCodePoint(int codePoint) 

Source Link

Document

Determines whether the specified code point is a valid <a href="http://www.unicode.org/glossary/#code_point"> Unicode code point value</a>.

Usage

From source file:org.rascalmpl.library.Prelude.java

public IValue stringChar(IInteger i) {
    int intValue = i.intValue();
    if (Character.isValidCodePoint(intValue)) {
        return values.string(intValue);
    } else {//from  w ww . j  ava  2 s  .  c  om
        throw RuntimeExceptionFactory.illegalArgument(i, null, null);
    }
}

From source file:org.rascalmpl.library.Prelude.java

public IValue stringChars(IList lst) {
    int[] chars = new int[lst.length()];

    for (int i = 0; i < lst.length(); i++) {
        chars[i] = ((IInteger) lst.get(i)).intValue();
        if (!Character.isValidCodePoint(chars[i])) {
            throw RuntimeExceptionFactory.illegalArgument(values.integer(chars[i]), null, null);
        }//ww  w.j av a2s .  c om
    }

    return values.string(chars);
}