org.jopendocument.util
Class StringUtils

java.lang.Object
  extended by org.jopendocument.util.StringUtils

public class StringUtils
extends java.lang.Object

Author:
Sylvain CUAZ

Nested Class Summary
static class StringUtils.Escaper
           
static class StringUtils.Shortener
           
 
Field Summary
static java.nio.charset.Charset ASCII
           
static java.nio.charset.Charset Cp1252
           
static java.nio.charset.Charset Cp850
           
static java.nio.charset.Charset ISO8859_1
           
static java.nio.charset.Charset UTF16
           
static java.nio.charset.Charset UTF8
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String doubleQuote(java.lang.String s)
           
static java.util.List<java.lang.String> fastSplit(java.lang.String string, char sep)
           
static java.lang.String firstUp(java.lang.String s)
           
static java.lang.String firstUpThenLow(java.lang.String s)
          Retourne la chaine avec la première lettre en majuscule et le reste en minuscule.
static java.lang.String getBoundedLengthString(java.lang.String s, int maxLength)
          Return a string built from s that is at most maxLength long.
static int getLeastMaximum()
          The minimum value for getBoundedLengthString(String, int).
static java.lang.String leftAlign(java.lang.String s, int width)
           
static java.lang.String rightAlign(java.lang.String s, int width)
           
static java.lang.String splitString(java.lang.String s, int nbCharMaxLine)
          Split une string s tous les nbCharMaxLine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

public static final java.nio.charset.Charset UTF8

UTF16

public static final java.nio.charset.Charset UTF16

ASCII

public static final java.nio.charset.Charset ASCII

ISO8859_1

public static final java.nio.charset.Charset ISO8859_1

Cp1252

public static final java.nio.charset.Charset Cp1252

Cp850

public static final java.nio.charset.Charset Cp850
Constructor Detail

StringUtils

public StringUtils()
Method Detail

firstUpThenLow

public static java.lang.String firstUpThenLow(java.lang.String s)
Retourne la chaine avec la première lettre en majuscule et le reste en minuscule.

Parameters:
s - la chaîne à transformer.
Returns:
la chaine avec la première lettre en majuscule et le reste en minuscule.

firstUp

public static java.lang.String firstUp(java.lang.String s)

getLeastMaximum

public static final int getLeastMaximum()
The minimum value for getBoundedLengthString(String, int).

Returns:
the minimum value for maxLength.

getBoundedLengthString

public static final java.lang.String getBoundedLengthString(java.lang.String s,
                                                            int maxLength)
                                                     throws java.lang.IllegalArgumentException
Return a string built from s that is at most maxLength long.

Parameters:
s - the string to bound.
maxLength - the maximum length the result must have.
Returns:
a string built from s.
Throws:
java.lang.IllegalArgumentException - if maxLength is too small.
See Also:
getLeastMaximum(), StringUtils.Shortener.getBoundedLengthString(String, int)

fastSplit

public static final java.util.List<java.lang.String> fastSplit(java.lang.String string,
                                                               char sep)

splitString

public static java.lang.String splitString(java.lang.String s,
                                           int nbCharMaxLine)
Split une string s tous les nbCharMaxLine

Parameters:
s -
nbCharMaxLine -
Returns:

doubleQuote

public static java.lang.String doubleQuote(java.lang.String s)

rightAlign

public static java.lang.String rightAlign(java.lang.String s,
                                          int width)

leftAlign

public static java.lang.String leftAlign(java.lang.String s,
                                         int width)