PPF API
Version 0.6

net.sourceforge.ppf.util
Class StringUtil

java.lang.Object
  extended by net.sourceforge.ppf.util.StringUtil

public abstract class StringUtil
extends java.lang.Object

Misc. String utilities

Author:
DeadEd, 2Fast2BCn

Field Summary
static java.lang.String BACKGROUND
           
static java.lang.String BLACK
           
static java.lang.String BLUE
           
static java.lang.String BOLD
           
static java.lang.String BROWN
           
static java.lang.String[] COLOR_CODES
           
static java.lang.String[] COLOR_HTML
           
static java.lang.String[] COLOR_SIGNS
           
static java.lang.String CYAN
           
static java.lang.String DARK_BLUE
           
static java.lang.String DARK_GRAY
           
static java.lang.String DARK_GREEN
           
static java.lang.String[] FORMATTING_CODES
           
static java.lang.String[] FORMATTING_HTML
           
static java.lang.String[] FORMATTING_SIGNS
           
static java.lang.String GREEN
           
static java.lang.String LIGHT_GRAY
           
static java.lang.String MAGENTA
           
static java.lang.String NORMAL
           
static java.lang.String OLIVE
           
static java.lang.String PURPLE
           
static java.lang.String RED
           
static java.lang.String REVERSE
           
static java.lang.String TEAL
           
static java.lang.String UNDERLINE
           
static java.lang.String WHITE
           
static java.lang.String YELLOW
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String formatUser(java.lang.String nick, java.lang.String login, java.lang.String hostname)
          builds the usual nick!
static java.lang.String prependHash(java.lang.String channelName)
          If the channelName does not start with a known prefix ('#' or '&') prepend it with a hash '#'.
static java.lang.String replaceCodesToUTF8(java.lang.String line)
          Replaces all formatting and colours from a line of IRC text to UTF-8.
static java.lang.String replaceHTMLTags(java.lang.String str)
          removes some HTML tags and replaces some codes

todo complete... or find better dynamic way...

static java.lang.String replaceUTF8ToCodes(java.lang.String original)
          Replaces all occurences of some special variables with their color/formatting code in IRC format.
static java.lang.String replaceUTF8ToHTML(java.lang.String original)
          Replaces all occurences of some special variables with their color/formatting code in HTML format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

public static java.lang.String BLACK

BLUE

public static java.lang.String BLUE

BROWN

public static java.lang.String BROWN

CYAN

public static java.lang.String CYAN

DARK_BLUE

public static java.lang.String DARK_BLUE

DARK_GRAY

public static java.lang.String DARK_GRAY

DARK_GREEN

public static java.lang.String DARK_GREEN

GREEN

public static java.lang.String GREEN

LIGHT_GRAY

public static java.lang.String LIGHT_GRAY

MAGENTA

public static java.lang.String MAGENTA

OLIVE

public static java.lang.String OLIVE

PURPLE

public static java.lang.String PURPLE

RED

public static java.lang.String RED

TEAL

public static java.lang.String TEAL

WHITE

public static java.lang.String WHITE

YELLOW

public static java.lang.String YELLOW

BOLD

public static java.lang.String BOLD

NORMAL

public static java.lang.String NORMAL

REVERSE

public static java.lang.String REVERSE

UNDERLINE

public static java.lang.String UNDERLINE

BACKGROUND

public static java.lang.String BACKGROUND

COLOR_SIGNS

public static java.lang.String[] COLOR_SIGNS

COLOR_CODES

public static java.lang.String[] COLOR_CODES

COLOR_HTML

public static java.lang.String[] COLOR_HTML

FORMATTING_SIGNS

public static java.lang.String[] FORMATTING_SIGNS

FORMATTING_CODES

public static java.lang.String[] FORMATTING_CODES

FORMATTING_HTML

public static java.lang.String[] FORMATTING_HTML
Constructor Detail

StringUtil

public StringUtil()
Method Detail

prependHash

public static java.lang.String prependHash(java.lang.String channelName)
If the channelName does not start with a known prefix ('#' or '&') prepend it with a hash '#'.

Parameters:
channelName - the channel name
Returns:
The channelName, prepended with a hash if it doesn't start with a known prefix.

formatUser

public static java.lang.String formatUser(java.lang.String nick,
                                          java.lang.String login,
                                          java.lang.String hostname)
builds the usual nick!login@hostname string.


replaceHTMLTags

public static final java.lang.String replaceHTMLTags(java.lang.String str)
removes some HTML tags and replaces some codes

todo complete... or find better dynamic way... todo I'm not happy with this code... todo we might change into IRC code for bold

Parameters:
str -
Returns:

replaceUTF8ToCodes

public static java.lang.String replaceUTF8ToCodes(java.lang.String original)
Replaces all occurences of some special variables with their color/formatting code in IRC format.

The variables are in the form $VARIABLE, where VARIABLE is the name of one of the constants in Colors.

Parameters:
original -
Returns:

replaceUTF8ToHTML

public static java.lang.String replaceUTF8ToHTML(java.lang.String original)
Replaces all occurences of some special variables with their color/formatting code in HTML format.

todo implement (close all opened color codes... / backgroundcolors)

The variables are in the form $VARIABLE, where VARIABLE is the name of one of the constants in Colors.

Parameters:
original -
Returns:

replaceCodesToUTF8

public static java.lang.String replaceCodesToUTF8(java.lang.String line)
Replaces all formatting and colours from a line of IRC text to UTF-8.

Parameters:
line - the input text.
Returns:
the same text, but with PPF color codes formatting and colour characters.

PPF API
Version 0.6

PircBot Plugin Framework API 0.6
© 2003-2004 DeadEd e.a. ppf.sourceforge.net