Adempiere 3.5.2a

org.compiere.cm
Class StringUtil

java.lang.Object
  extended by org.compiere.cm.StringUtil

public class StringUtil
extends Object

StringUtil is a helper class to run different String managements not implemented in Java Core

Version:
$id$
Author:
Yves Sandfort

Constructor Summary
StringUtil()
           
 
Method Summary
static int count(String orig, String find)
          Should return you the number of occurences of "find" in "orig
static String crc(String tempStr)
          Gnerate CRC String for tempStr
static String getNextWord(String tempStr)
          To split for indexes we will look for the next Word in tempstr
static String remove(String original, String toBeRemoved, boolean ignoreCase)
          Remove String toBeRemoved from oroginal
static String removeSpecialChar(String tempStr)
          For some save scnearios and analysis we should remove special characters, i.e.
static StringBuffer replace(StringBuffer original, String search, String replace)
          Replace all occurences of search with replace in original
static StringBuffer replace(StringBuffer original, String search, String replace, boolean ignoreCase, boolean allOccurences)
          Replace all or one occurence of search with replace in original
static String replace(String original, char search, String replace)
          Replace all occurences of search with replace in original
static String replace(String original, String search, String replace)
          Replace all occurences of search with replace in original
static String replace(String original, String search, String replace, boolean ignoreCase, boolean allOccurences)
          Replace all or one occurence of search with replace in original
static StringBuffer replaceOne(StringBuffer original, String search, String replace)
          Replace one occurence of search with replace in original
static String replaceOne(String original, String search, String replace)
          Replace one occurence of search with replace in original
static StringBuffer replaceRegex(StringBuffer original, String regex, String replace, boolean CASE_INSENSITIVE)
          Run RegEx Expression against original String
static String replaceRegex(String original, String regex, String replace, boolean CASE_INSENSITIVE)
          Run RegEx Expression against original String
static String[] split(String searchIn, String splitter)
          This function will split a string based on a split character.
 
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 StringBuffer replace(StringBuffer original,
                                   String search,
                                   String replace)
Replace all occurences of search with replace in original

Parameters:
original - the original String
search - the string to look for
replace - the string we will replace search with
Returns:
StringBuffer with result

replace

public static String replace(String original,
                             String search,
                             String replace)
Replace all occurences of search with replace in original

Parameters:
original - the original String
search - the string to look for
replace - the string we will replace search with
Returns:
String with result, null will get replaced by ""

replace

public static String replace(String original,
                             char search,
                             String replace)
Replace all occurences of search with replace in original

Parameters:
original - the original String
search - the string to look for
replace - the string we will replace search with
Returns:
String with result, null will get replaced by ""

replace

public static StringBuffer replace(StringBuffer original,
                                   String search,
                                   String replace,
                                   boolean ignoreCase,
                                   boolean allOccurences)
Replace all or one occurence of search with replace in original

Parameters:
original - the original StringBuffer
search - String to get replaced
replace - String to replace
ignoreCase - should we ignore cases
allOccurences - should all Occurences get replaced
Returns:
StringBuffer with result

replace

public static String replace(String original,
                             String search,
                             String replace,
                             boolean ignoreCase,
                             boolean allOccurences)
Replace all or one occurence of search with replace in original

Parameters:
original - the original StringBuffer
search - String to get replaced
replace - String to replace
ignoreCase - should we ignore cases
allOccurences - should all Occurences get replaced
Returns:
StringBuffer with result

replaceOne

public static StringBuffer replaceOne(StringBuffer original,
                                      String search,
                                      String replace)
Replace one occurence of search with replace in original

Parameters:
original - StringBuffer
search - String to look for
replace - String to replace search with
Returns:
new StringBuffer with result

replaceOne

public static String replaceOne(String original,
                                String search,
                                String replace)
Replace one occurence of search with replace in original

Parameters:
original - String to look in
search - String to search for
replace - String to replace search with
Returns:
new String with result

replaceRegex

public static StringBuffer replaceRegex(StringBuffer original,
                                        String regex,
                                        String replace,
                                        boolean CASE_INSENSITIVE)
Run RegEx Expression against original String

Parameters:
original - StringBuffer with original context
regex - Regular Expression to run as query
replace - Replace String
CASE_INSENSITIVE - whether we should take care of case or not
Returns:
StringBuffer with result

replaceRegex

public static String replaceRegex(String original,
                                  String regex,
                                  String replace,
                                  boolean CASE_INSENSITIVE)
Run RegEx Expression against original String

Parameters:
original - StringBuffer with original context
regex - Regular Expression to run as query
replace - Replace String
CASE_INSENSITIVE - whether we should take care of case or not
Returns:
String with result

split

public static String[] split(String searchIn,
                             String splitter)
This function will split a string based on a split character.

Parameters:
searchIn - The string to split
splitter - The separator
Returns:
String array of split values

remove

public static String remove(String original,
                            String toBeRemoved,
                            boolean ignoreCase)
Remove String toBeRemoved from oroginal

Parameters:
original - String to look in
toBeRemoved - String to get removed
ignoreCase - should we take care of case
Returns:
String without toBeRemoved

getNextWord

public static String getNextWord(String tempStr)
To split for indexes we will look for the next Word in tempstr

Parameters:
tempStr - to look into
Returns:
nextWord in String

removeSpecialChar

public static String removeSpecialChar(String tempStr)
For some save scnearios and analysis we should remove special characters, i.e. HTML

Parameters:
tempStr - to remove Special Char
Returns:
new String without special chars

count

public static int count(String orig,
                        String find)
Should return you the number of occurences of "find" in "orig

Parameters:
orig - The String to look in
find - The String to look for
Returns:
Number of occurences, 0 if none

crc

public static String crc(String tempStr)
                  throws IOException
Gnerate CRC String for tempStr

Parameters:
tempStr -
Returns:
CRC Code for tempStr
Throws:
IOException

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.