TV-Browser 3.3.3 API

util.i18n
Class WritingConversion

java.lang.Object
  extended by util.i18n.WritingConversion

public class WritingConversion
extends java.lang.Object

Author:
Jo

Constructor Summary
WritingConversion()
           
 
Method Summary
static java.lang.String reduceToASCIILetters(java.lang.String string, boolean replaceUnsupportedChars)
          Reduces String to ASCII letters by removing punctuation and redundant whitespaces and replacing non-ASCII letters with similar ASCII letters if available.
static java.lang.String removeDiacriticalMarks(java.lang.String string)
          Remove any diacritical marks (accents like ç, ñ, é, etc) from the given string.
static java.lang.String removeRedundantWhitespaces(java.lang.String string)
          Replace whitespaces with a single space
static java.lang.String replaceLatinDerivedLetters(java.lang.String string)
          Replaces non-ASCII latin derived letters with similar ASCII letters if available.
static java.lang.String replacePunctuation(java.lang.String string, java.lang.String replaceString)
          Replace punctuation (!"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WritingConversion

public WritingConversion()
Method Detail

removeDiacriticalMarks

public static java.lang.String removeDiacriticalMarks(java.lang.String string)
Remove any diacritical marks (accents like ç, ñ, é, etc) from the given string. from http://balusc.blogspot.com/2006/10/stringutil.html no copyright since it's too simple ;-)

Parameters:
string - The string to remove diacritical marks from.
Returns:
The string with removed diacritical marks, if any.

replaceLatinDerivedLetters

public static java.lang.String replaceLatinDerivedLetters(java.lang.String string)
Replaces non-ASCII latin derived letters with similar ASCII letters if available.
(currently supported: ISO-8859-1 to -4, ISO-8859-9, -10, ISO 8859-13 to -16, Windows-1252, MacRoman)

Parameters:
string - The string to replace non-ASCII letters.
Returns:
The string with all supported non-ASCII letters replaced.

replacePunctuation

public static java.lang.String replacePunctuation(java.lang.String string,
                                                  java.lang.String replaceString)
Replace punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~¿¡ dashes and quotation marks) with a given string

Parameters:
string - The string to replace punctuation from.
replaceString - The string to replace the punctuation with
Returns:
The string with removed punctuation, if any.

removeRedundantWhitespaces

public static java.lang.String removeRedundantWhitespaces(java.lang.String string)
Replace whitespaces with a single space

Parameters:
string - The string to replace whitespaces from.
Returns:
The string with replaced whitespaces, if any.

reduceToASCIILetters

public static java.lang.String reduceToASCIILetters(java.lang.String string,
                                                    boolean replaceUnsupportedChars)
Reduces String to ASCII letters by removing punctuation and redundant whitespaces and replacing non-ASCII letters with similar ASCII letters if available.
(currently supported: ISO-8859-1 to -4, ISO-8859-9, -10, ISO 8859-13 to -16, Windows-1252, MacRoman)

Parameters:
string - The string to reduce.
replaceUnsupportedChars - If true, all characters that can't be replaced with ASCII letters will be replaced with an underscore.
Returns:
The reduced string.

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)