com.tekann.codegen.pda.util
Class StringUtil

java.lang.Object
  extended by com.tekann.codegen.pda.util.StringUtil

public class StringUtil
extends java.lang.Object

Utilities String in TotalCross.

Author:
guilherme

Constructor Summary
StringUtil()
           
 
Method Summary
static int getMaxStringLength(totalcross.ui.font.FontMetrics fm, int width, java.lang.String text)
          Deprecated. Use instead Convert.insertLineBreak
static java.lang.String lineBreakWithPipes(java.lang.String line, int maxCharsPerLine)
          Deprecated. Use instead Convert.insertLineBreak
static java.lang.String replaceInvalidChars(java.lang.String value)
          Replace the following chars:
\\n by \n
\\r by \r
\\t by \t
\\b by \b
\\f by \f
\\" by \"
static java.lang.String replaceInvalidCharsToXML(java.lang.String value)
          Replaces the following character.
static void replaceNull(java.lang.String[][] s)
          Replaces the null values by an empty string.
static java.lang.Object[] split(java.lang.String toSplit, char separator)
          Split a String.
static java.lang.Object[] split(java.lang.String toSplit, char separator, boolean allowEmpty)
          Split a String.
static java.lang.String toCurrencyString(double d, int decimalPlaces)
          Format the string like the Convert.toCurrencyString does, but it also
add zeros when needed.
static java.lang.String toCurrencyString(java.lang.String s, int decimalPlaces)
          Format the string like the Convert.toCurrencyString does, but it also
add zeros when needed.
static java.lang.String toString(java.lang.String[] values, java.lang.String separator)
          Return string representation of an array with a separator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

replaceNull

public static void replaceNull(java.lang.String[][] s)
Replaces the null values by an empty string. It is necessary to use the setItems(String[][]) that can not accept null values

Parameters:
s -

split

public static java.lang.Object[] split(java.lang.String toSplit,
                                       char separator)
Split a String. With no empty Strings.

Parameters:
toSplit - String to split.
separator - Separator for the split.
Returns:
Array with the strings.

split

public static java.lang.Object[] split(java.lang.String toSplit,
                                       char separator,
                                       boolean allowEmpty)
Split a String.

Parameters:
toSplit - String to split.
separator - Separator for the split.
allowEmpty - Add even if the string is empty.
Returns:
Array with the strings.

lineBreakWithPipes

public static java.lang.String lineBreakWithPipes(java.lang.String line,
                                                  int maxCharsPerLine)
Deprecated. Use instead Convert.insertLineBreak

Break a text line based on max chars per line.

Parameters:
line - Line to break.
maxCharsPerLine - Max number of chars per line.
Returns:
A String
See Also:
Convert.insertLineBreak(int, totalcross.ui.font.FontMetrics, java.lang.String)

getMaxStringLength

public static int getMaxStringLength(totalcross.ui.font.FontMetrics fm,
                                     int width,
                                     java.lang.String text)
Deprecated. Use instead Convert.insertLineBreak

Return max char's number in width using FontMetrics.

Parameters:
fm - The FontMetrics to calculate.
width - Width of control or area.
text - Full text.
Returns:
An integer
See Also:
Convert.insertLineBreak(int, totalcross.ui.font.FontMetrics, java.lang.String)

toString

public static java.lang.String toString(java.lang.String[] values,
                                        java.lang.String separator)
Return string representation of an array with a separator.

Parameters:
values -
separator -
Returns:

toCurrencyString

public static java.lang.String toCurrencyString(double d,
                                                int decimalPlaces)
Format the string like the Convert.toCurrencyString does, but it also
add zeros when needed.

Parameters:
d -
decimalPlaces -
Returns:

toCurrencyString

public static java.lang.String toCurrencyString(java.lang.String s,
                                                int decimalPlaces)
Format the string like the Convert.toCurrencyString does, but it also
add zeros when needed.

Parameters:
s -
decimalPlaces -
Returns:

replaceInvalidCharsToXML

public static java.lang.String replaceInvalidCharsToXML(java.lang.String value)
Replaces the following character.
& &
< <
> >
" "
' '

Parameters:
value -
Returns:

replaceInvalidChars

public static java.lang.String replaceInvalidChars(java.lang.String value)
Replace the following chars:
\\n by \n
\\r by \r
\\t by \t
\\b by \b
\\f by \f
\\" by \"

Parameters:
value -
Returns: