TPTP 4.6.0 Platform Project
Internal API Specification

org.eclipse.hyades.ui.internal.util
Class StringUtil

java.lang.Object
  extended by org.eclipse.hyades.ui.internal.util.StringUtil

public class StringUtil
extends java.lang.Object

Contains String utility methods.


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String decode(java.lang.String encoding, byte[] data)
          Decodes a byte array from specified encoding to a unicode String.
static byte[] encode(java.lang.String encoding, java.lang.String text)
          Encodes a String from unicode to the specified encoding.
static int indexOf(java.lang.StringBuffer in, java.lang.String str, int fromIndex)
          Implements the String.indexOf(java.lang.String, int) method but looking for a String in a StringBuffer.
static boolean isDigits(java.lang.String string)
          Returns true if all chars are in '0' - '9' or false otherwise.
static java.lang.String replace(java.lang.String in, java.lang.String oldString, java.lang.String newString)
          Returns a new string resulting from replacing all occurrences of oldString in the "in" string with newString.
static java.lang.String[] tokenizer(java.lang.String text, java.lang.String token, boolean includeToken)
          Light version of the tokenizer facilities provided by StringTokenizer.
static java.lang.String toProperCase(java.lang.String text)
          Returns the proper case of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

replace

public static java.lang.String replace(java.lang.String in,
                                       java.lang.String oldString,
                                       java.lang.String newString)
Returns a new string resulting from replacing all occurrences of oldString in the "in" string with newString.

If in or oldString are null then this method returns null. If newString is null then oldString is replaced by "".

Parameters:
in -
oldString -
newString -
Returns:
String

indexOf

public static int indexOf(java.lang.StringBuffer in,
                          java.lang.String str,
                          int fromIndex)
Implements the String.indexOf(java.lang.String, int) method but looking for a String in a StringBuffer.

This method can be really handful when implement algorithm using StringBuffers since it helps to eliminate the use or creation of Strings.

Any argument can be equals null.

Parameters:
in -
str -
fromIndex -
Returns:

tokenizer

public static java.lang.String[] tokenizer(java.lang.String text,
                                           java.lang.String token,
                                           boolean includeToken)
Light version of the tokenizer facilities provided by StringTokenizer.

Parameters:
text - to be tokenized
token -
includeToken - If true the tokens are included in the array.
Returns:
String[]

encode

public static byte[] encode(java.lang.String encoding,
                            java.lang.String text)
Encodes a String from unicode to the specified encoding. This method returns null if the encoding is not supported

Parameters:
encoding -
text -
Returns:
byte[]

decode

public static java.lang.String decode(java.lang.String encoding,
                                      byte[] data)
Decodes a byte array from specified encoding to a unicode String. This method returns null if the encoding is not supported

Parameters:
encoding -
text -
Returns:
byte[]

isDigits

public static boolean isDigits(java.lang.String string)
Returns true if all chars are in '0' - '9' or false otherwise.

Parameters:
string -
Returns:
boolean

toProperCase

public static java.lang.String toProperCase(java.lang.String text)
Returns the proper case of a string. Examples: this is a text => This Is A Text myClass => MyClass


TPTP 4.6.0 Platform Project
Internal API Specification