Class IRCUtil

    • Field Detail

      • colorIndicator

        public static char colorIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and shows that a color-code starts / ends. Here it is as the ASCII decimal int 3.
      • boldIndicator

        public static char boldIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and shows that bold starts / ends. Here it is as the ASCII decimal int 32.
      • underlinedIndicator

        public static char underlinedIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and shows that bold starts / ends. Here it is as the ASCII decimal int 2.
      • colorEndIndicator

        public static char colorEndIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and shows that bold, underline and colors end. Here it is as the ASCII decimal int 15.
      • colorReverseIndicator

        public static char colorReverseIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and indicates that the client's colors are reversed (background -> foreground and foreground -> background). Here it is as the ASCII decimal int 1.
      • actionIndicator

        public static char actionIndicator
        Deprecated.
        Moved to IRCConstants.
        This is part of the mIRC code and shows that a PRIVMSG is an ACTION (/me). Here it is as the ASCII decimal int 22.
    • Method Detail

      • isChan

        public static boolean isChan​(java.lang.String str)
        According to RFC2812 the channel's name may and must start with one of the following characters.
        • ! == 33 (ASCII)
        • # == 35
        • & == 38
        • + == 43
        .
        Parameters:
        str - The name to check if it's a channel.
        Returns:
        true if the argument starts with one of the characters mentioned above.
      • parseInt

        public static int parseInt​(java.lang.String str)
        Parses a String to an int via Integer.parseInt but avoids the NumberFormatException.
        Parameters:
        str - The String to parse.
        Returns:
        The parsed new int. -1 if NumberFormatException was thrown.
      • parseColors

        public static java.lang.String parseColors​(java.lang.String str)
        Erases the mIRC colorcodes from a String. The documentation of the evil color codes is available on http://www.mirc.co.uk/help/color.txt. This method links to the parseColors(StringBuffer) method.
        Parameters:
        str - The line which should be parsed.
        Returns:
        A line cleaned from any mIRC colorcodes.
        See Also:
        parseColors(StringBuffer)
      • parseColors

        public static java.lang.StringBuffer parseColors​(java.lang.StringBuffer buf)
        Erases the mIRC colorcodes from a String. The documentation of the evil color codes is available on http://www.mirc.co.uk/help/color.txt.
        Parameters:
        buf - The line which should be parsed.
        Returns:
        A line as StringBuffer object which is cleaned from any mIRC colorcodes.
        See Also:
        parseColors(String)
      • split

        public static java.lang.String[] split​(java.lang.String str,
                                               int delim,
                                               java.lang.String trailing)
        Splits a string into substrings.
        Parameters:
        str - The string which is to split.
        delim - The delimiter character, for example a space ' '.
        trailing - The ending which is added as a substring though it wasn't in the str. This parameter is just for the IRCParser class which uses this method to split the middle part into the parameters. But as last parameter always the trailing is added. This is done here because it's the fastest way to do it here.
        If the end is null or "", nothing is appended.
        Returns:
        An array with all substrings.
        See Also:
        split(String, int)
      • split

        public static java.lang.String[] split​(java.lang.String str,
                                               int delim)
        Splits a string into substrings. This method is totally equal to split(str, delim, null).
        Parameters:
        str - The string which is to split.
        delim - The delimiter character, for example a space ' '.
        Returns:
        An array with all substrings.
        See Also:
        split(String, int, String)