Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/* 
 * IRClib -- A Java Internet Relay Chat library -- class IRCUtil
 * Copyright (C) 2002, 2003 Christoph Schwering <ch@schwering.org>
 * 
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free 
 * Software Foundation; either version 2.1 of the License, or (at your option) 
 * any later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
 * details.
 * You should have received a copy of the GNU Lesser General Public License 
 * along with this library; if not, write to the Free Software Foundation, 
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */

public class Main {
    /** 
     * According to RFC2812 the channel's name may and must start with one of the
     * following characters.
     * <ul>
     * <li>! == 33 (ASCII)</li>
     * <li># == 35</li>
     * <li>&amp; == 38</li>
     * <li>+ == 43</li>
     * </ul>. 
     * @param str The name to check if it's a channel. 
     * @return <code>true</code> if the argument starts with one of the characters
     *         mentioned above.
     */
    public static boolean isChan(String str) {
        int c;
        return (str.length() >= 2) && ((c = str.charAt(0)) == 35 || c == 38 || c == 33 || c == 43);
    }
}