Indicates if the given character is a separator. - Java java.lang

Java examples for java.lang:char

Description

Indicates if the given character is a separator.

Demo Code


//package com.java2s;

public class Main {
    /**//from www  .  ja v a  2s.c o m
     * Indicates if the given character is a separator.
     * 
     * @param character
     *            The character to test.
     * @return True if the given character is a separator.
     */
    public static boolean isSeparator(int character) {
        switch (character) {
        case '(':
        case ')':
        case '<':
        case '>':
        case '@':
        case ',':
        case ';':
        case ':':
        case '\\':
        case '"':
        case '/':
        case '[':
        case ']':
        case '?':
        case '=':
        case '{':
        case '}':
        case ' ':
        case '\t':
            return true;

        default:
            return false;
        }
    }
}

Related Tutorials