com.tecnick.htmlutils.htmlstrings
Class HTMLStrings

java.lang.Object
  extended by com.tecnick.htmlutils.htmlstrings.HTMLStrings

public class HTMLStrings
extends java.lang.Object

Collection of static utility methods to manipulate HTML strings.

Copyright (c) 2004-2006 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
Project homepage: http://htmlstrings.sourceforge.net
License: http://www.gnu.org/copyleft/lesser.html LGPL

Version:
1.0.004
Author:
Nicola Asuni [www.tecnick.com].

Constructor Summary
HTMLStrings()
          Void Constructor.
 
Method Summary
static java.lang.String autoBR(java.lang.String str)
          Replace newlines characters sequences with <br/> element.
static java.lang.String charsetToUnicode(java.lang.String source, java.lang.String encoding)
          Converts byte-oriented character set such as ISO-8859-1 to UTF-8 Unicode.
static java.lang.String compactString(java.lang.String str)
          Replace the following characters sequences with a blank space: "\t" (ASCII 9 (0x09)), a tab "\n" (ASCII 10 (0x0A)), a new line (line feed) "\r" (ASCII 13 (0x0D)), a carriage return "\0" (ASCII 0 (0x00)), the NUL-byte "\f" ( '), a form feed.
static java.lang.String getEncodedString(java.lang.String source, java.lang.String encoding_in, java.lang.String encoding_out)
          Convert string to the requested encoding.
static java.lang.String unicodeToCharset(java.lang.String source, java.lang.String encoding)
          Converts UTF-8 Unicode strings to byte-oriented character set such as ISO-8859-1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLStrings

public HTMLStrings()
Void Constructor.

Method Detail

charsetToUnicode

public static java.lang.String charsetToUnicode(java.lang.String source,
                                                java.lang.String encoding)
Converts byte-oriented character set such as ISO-8859-1 to UTF-8 Unicode.

Parameters:
source - String source string to convert
encoding - String input encoding (name of a supported charset)
Returns:
String converted string, or original string in case of error

unicodeToCharset

public static java.lang.String unicodeToCharset(java.lang.String source,
                                                java.lang.String encoding)
Converts UTF-8 Unicode strings to byte-oriented character set such as ISO-8859-1.

Parameters:
source - String source string to convert
encoding - String output encoding (name of a supported charset)
Returns:
String converted string, or original string in case of error

getEncodedString

public static java.lang.String getEncodedString(java.lang.String source,
                                                java.lang.String encoding_in,
                                                java.lang.String encoding_out)
Convert string to the requested encoding.

Parameters:
source - String HTML source code to convert
encoding_in - String input encoding (name of a supported charset)
encoding_out - String output encoding (name of a supported charset)
Returns:
String converted string, or original string in case of error

compactString

public static java.lang.String compactString(java.lang.String str)
Replace the following characters sequences with a blank space:

Parameters:
str - the input string
Returns:
compacted string

autoBR

public static java.lang.String autoBR(java.lang.String str)
Replace newlines characters sequences with <br/> element.

Parameters:
str - String text to change
Returns:
String original string with replaced newlines