Package org.brijframework.util.text
Class StringUtil
- java.lang.Object
-
- org.brijframework.util.text.StringUtil
-
public class StringUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringaddUnderScoreBeforeUpperCaseLetter(String str)converts string format put UnderScore '_' before first Cap char and converts to UPPER case eg.static StringarrayToCommaText(Object[] array)static StringarrayToTildeText(Object[] array)static Stringbetween(String original, String start, String end)static StringcapitalFirst(String text)capital first letter in textstatic StringcapitalFirstLetterText(String _textline)Capital first letter of word in textstatic intcharCountInText(String _sources, char ch)static intcharIndex(String sources, int start, char ch)static StringcleanAndReplaceText(String _source, String _replaceValue)clean all and replace ignore value to replace value and get string only number or charstatic StringcleanText(String _source)clean all and get string only number or charstatic booleancontains(String _search, String... sources)This method searches for a specified string in string array.static booleancontainsEquals(Object obj1, Object obj2)This method matching for both object .static booleancontainsIgnoreCase(Object[] stringArray, Object searchString)This method searches for a specified string in string array ignoring the case.static booleancontainsIgnoreCase(Object stringArray, Object searchString)This method searches for a specified string in string array ignoring the case.static booleancontainsIgnoreCase(String[] stringArray, String searchString)This method searches for a specified string in string array ignoring the case.static StringfriendlyNameForJavaVar(String string)method is used to get the title case format for the string passed.static StringgetBefore(StringBuffer sources, String match)static StringgetBefore(String original, String match)static StringgetCharNTimes(char c, int n)static StringgetCsl(ArrayList<?> toEmailAddressArray, String string)static StringgetDelimString(Iterable<?> iterable, String sepStr)static StringgetOfter(StringBuffer sources, String match)static StringgetOfter(String original, String match)static StringgetTokenAtIndex(String _source, int index, String delimiter)Will get the token at a specified index in the string according to the delimiter we want to tokenize the string with.static booleanhasLength(String _text)check its have null or empty stringstatic booleanhasText(Object _text)check its type of string or char valuesstatic StringignoreFromText(String _source, char _harToDump)Ignore value and get clean textstatic intindexOfIgnoreCase(String typeName, String string)static booleanisEmpty(Object _text)check its null or empty char valuesstatic booleanisEmpty(String _text)check its null or empty char valuesstatic booleanisNonEmpty(String _v)check its not null or empty char valuesstatic StringjustifyText(String _source, int length, boolean isLeftJustify, char filled)Justify text given textstatic StringlowerFirst(String text)lower first letter in textstatic voidmain(String[] args)static StringmaskString(String rawStr, char c, String format)static booleanmatchIgnoreCase(Object obj1, Object obj2)This method matching ignoreCase for both object .static String[]parseTilde(String objectKeys)static StringreplaceText(String _sources, String replaceText, String withText)this is for replace text with given text from textstatic StringreverseText(String _source)reverse text of sources textstatic String[]split(String baseString, String splitString)static StringstringValue(Object obj)static StringtoCamelCase(String str)
-
-
-
Method Detail
-
hasLength
public static boolean hasLength(String _text)
check its have null or empty string- Parameters:
_text-- Returns:
- boolean
-
hasText
public static boolean hasText(Object _text)
check its type of string or char values- Parameters:
_text-- Returns:
- boolean
-
isEmpty
public static boolean isEmpty(Object _text)
check its null or empty char values- Parameters:
_text-- Returns:
- boolean
-
isEmpty
public static boolean isEmpty(String _text)
check its null or empty char values- Parameters:
_text-- Returns:
- boolean
-
isNonEmpty
public static boolean isNonEmpty(String _v)
check its not null or empty char values- Parameters:
_text-- Returns:
- boolean
-
contains
public static boolean contains(String _search, String... sources)
This method searches for a specified string in string array.
- Parameters:
sources- array in which string is to be searched_search- string that is to be searched.- Returns:
- boolean true,if string is found in array fasle, if string is not found in the specified array.
- Since:
- Foundation 1.0
-
containsEquals
public static boolean containsEquals(Object obj1, Object obj2)
This method matching for both object .
- Parameters:
obj1- any type of objectobj2- any type of object- Returns:
- boolean true,if string is found in array false, if string is not found in the specified array.
- Since:
- brijframework 1.0
-
matchIgnoreCase
public static boolean matchIgnoreCase(Object obj1, Object obj2)
This method matching ignoreCase for both object .
- Parameters:
obj1- any type of objectobj2- any type of object- Returns:
- boolean true,if string is found in array false, if string is not found in the specified array.
- Since:
- brijframework 1.0
-
containsIgnoreCase
public static boolean containsIgnoreCase(String[] stringArray, String searchString)
This method searches for a specified string in string array ignoring the case.
- Parameters:
stringArray- array in which string is to be searchedsearchString- string that is to be searched.- Returns:
- boolean true,if string is found in array fasle, if string is not found in the specified array.
- Since:
- brijframework 1.0
-
containsIgnoreCase
public static boolean containsIgnoreCase(Object stringArray, Object searchString)
This method searches for a specified string in string array ignoring the case.
- Parameters:
stringArray- array in which string is to be searchedsearchString- string that is to be searched.- Returns:
- boolean true,if string is found in array fasle, if string is not found in the specified array.
- Since:
- brijframework 1.0
-
containsIgnoreCase
public static boolean containsIgnoreCase(Object[] stringArray, Object searchString)
This method searches for a specified string in string array ignoring the case.
- Parameters:
stringArray- array in which string is to be searchedsearchString- string that is to be searched.- Returns:
- boolean true,if string is found in array fasle, if string is not found in the specified array.
- Since:
- brijframework 1.0
-
cleanText
public static String cleanText(String _source)
clean all and get string only number or char- Parameters:
_source-- Returns:
- string
-
cleanAndReplaceText
public static String cleanAndReplaceText(String _source, String _replaceValue)
clean all and replace ignore value to replace value and get string only number or char- Parameters:
_source-_replaceValue-- Returns:
- string
-
ignoreFromText
public static String ignoreFromText(String _source, char _harToDump)
Ignore value and get clean text- Parameters:
_source-_harToDump-- Returns:
- string
-
getTokenAtIndex
public static String getTokenAtIndex(String _source, int index, String delimiter)
Will get the token at a specified index in the string according to the delimiter we want to tokenize the string with.- Parameters:
_source- Stringindex- intdelimiter- String- Returns:
- String
-
reverseText
public static String reverseText(String _source)
reverse text of sources text- Parameters:
_source-- Returns:
- destination
-
replaceText
public static String replaceText(String _sources, String replaceText, String withText)
this is for replace text with given text from text- Parameters:
_sources-replaceText-withText-- Returns:
- replace text
-
capitalFirst
public static String capitalFirst(String text)
capital first letter in text- Parameters:
text-- Returns:
- first capital text
-
lowerFirst
public static String lowerFirst(String text)
lower first letter in text- Parameters:
text-- Returns:
- first capital text
-
capitalFirstLetterText
public static String capitalFirstLetterText(String _textline)
Capital first letter of word in text- Parameters:
_textline-- Returns:
- capital test
-
justifyText
public static String justifyText(String _source, int length, boolean isLeftJustify, char filled)
Justify text given text- Parameters:
_source-length-isLeftJustify-filled-- Returns:
- justify text
-
charCountInText
public static int charCountInText(String _sources, char ch)
-
getCharNTimes
public static String getCharNTimes(char c, int n)
-
addUnderScoreBeforeUpperCaseLetter
public static String addUnderScoreBeforeUpperCaseLetter(String str)
converts string format put UnderScore '_' before first Cap char and converts to UPPER case eg. if value of str is 'BrijSoftware' then it will converted to 'BRIJ_SOFTWARE'
-
friendlyNameForJavaVar
public static String friendlyNameForJavaVar(String string)
method is used to get the title case format for the string passed. for e.g. variableName the title case String would be Variable Name
Example
FNUtil.getTitleCaseString("variableName"); // result would be Variable Name
- Parameters:
string- containing the text to be converted into title case format- Returns:
- String object having passed string in title case
- Since:
- Foundation 1.0
-
charIndex
public static int charIndex(String sources, int start, char ch)
-
getOfter
public static String getOfter(StringBuffer sources, String match)
-
getBefore
public static String getBefore(StringBuffer sources, String match)
-
main
public static void main(String[] args)
-
-