| java.lang.Object net.sourceforge.squirrel_sql.fw.util.StringUtilities
StringUtilities | public class StringUtilities (Code) | | String handling utilities.
author: Colin Bell |
Method Summary | |
public static boolean | areStringsEqual(String str1, String str2) Return whether the 2 passed strings are equal. | public static String | chop(String aString) Chops off the very last character of the given string. | public static String | cleanString(String str) Clean the passed string. | public static int | countOccurences(String str, int ch) Return the number of occurences of a character in a string. | public static Byte[] | getByteArray(byte[] bytes) | public static int | getTokenBeginIndex(String selectSQL, String token) | public static boolean | isEmpty(String str) Return true if the passed string is null or empty. | public static String | join(String[] parts, String delim) Joins the specified parts separating each from one another with the
specified delimiter. | public static String[] | segment(String source, int maxSegmentSize) | public static String[] | split(String str, char delimiter) Split a string based on the given delimiter, but don't remove
empty elements.
Parameters: str - The string to be split. Parameters: delimiter - Split string based on this delimiter. Array of split strings. | public static String[] | split(String str, char delimiter, boolean removeEmpty) Split a string based on the given delimiter, optionally removing
empty elements.
Parameters: str - The string to be split. Parameters: delimiter - Split string based on this delimiter. Parameters: removeEmpty - If true then remove empty elements. Array of split strings. |
areStringsEqual | public static boolean areStringsEqual(String str1, String str2)(Code) | | Return whether the 2 passed strings are equal. This function
allows for null strings. If s1 and s1 are
both null they are considered equal.
Parameters: str1 - First string to check. Parameters: str2 - Second string to check. |
chop | public static String chop(String aString)(Code) | | Chops off the very last character of the given string.
Parameters: aString - a string to chop the specified string minus it's last character, or null for nullor empty string for a string with length == 0|1. |
cleanString | public static String cleanString(String str)(Code) | | Clean the passed string. Replace whitespace characters with a single
space. If a null string passed return an empty string. E.G.
replace
[pre]
\t\tselect\t* from\t\ttab01
[/pre]
with
[pre]
select * from tab01
[/pre]
Parameters: str - String to be cleaned. Cleaned string. |
countOccurences | public static int countOccurences(String str, int ch)(Code) | | Return the number of occurences of a character in a string.
Parameters: str - The string to check. Parameters: ch - The character check for. The number of times ch occurs in str. |
getByteArray | public static Byte[] getByteArray(byte[] bytes)(Code) | | |
getTokenBeginIndex | public static int getTokenBeginIndex(String selectSQL, String token)(Code) | | |
isEmpty | public static boolean isEmpty(String str)(Code) | | Return true if the passed string is null or empty.
Parameters: str - String to be tested. true if the passed string is null or empty. |
join | public static String join(String[] parts, String delim)(Code) | | Joins the specified parts separating each from one another with the
specified delimiter. If delim is null, then this merely returns the
concatenation of all the parts.
Parameters: parts - the strings to be joined Parameters: delim - the char(s) that should separate the parts in the result a string representing the joined parts. |
split | public static String[] split(String str, char delimiter)(Code) | | Split a string based on the given delimiter, but don't remove
empty elements.
Parameters: str - The string to be split. Parameters: delimiter - Split string based on this delimiter. Array of split strings. Guaranteeded to be not null. |
split | public static String[] split(String str, char delimiter, boolean removeEmpty)(Code) | | Split a string based on the given delimiter, optionally removing
empty elements.
Parameters: str - The string to be split. Parameters: delimiter - Split string based on this delimiter. Parameters: removeEmpty - If true then remove empty elements. Array of split strings. Guaranteeded to be not null. |
|
|