Package org
Class StringManipulationTools
java.lang.Object
org.StringManipulationTools
- All Implemented Interfaces:
HelperClass
public class StringManipulationTools extends Object implements HelperClass
- Author:
- klukas
-
Field Summary
Fields Modifier and Type Field Description static String[][]htmlNamedEntity2Unicodestatic StringUnicode -
Constructor Summary
Constructors Constructor Description StringManipulationTools() -
Method Summary
Modifier and Type Method Description static List<Integer>getAllNumbersFromString(String str)static StringgetFileSystemName(String name)static StringgetNumbersFromString(String s)static StringgetStringList(ArrayList<?> elements, String div)static StringgetWordWrap(String[] desc, int width)static StringgetWordWrap(String desc, int width)static StringhtmlNamedEntities2Unicode(String html)converts all HTML named entities within a string to unicodestatic StringhtmlToUnicode(String html)static StringremoveHTMLtags(String textWithHtmlTags)static StringremoveNumbersFromString(String s)static StringremoveTags(String textWithHtmlTags, String tagA, String tagB)static ArrayList<String>removeTagsGetTextAndRemovedTexts(String textWithHtmlTags, String tagA, String tagB)Removes the tags from a html-text and gives back the striped text.static Stringreverse(String in)static String[]splitSafe(String str, String delimiter)static StringstringReplace(String s, String find, String replace)Replace occurrences of a substring.static StringUnicodeToHtml(String unicodeText)static StringUnicodeToHtml(String unicodeText, HashSet<Character> badChars)static StringUnicodeToURLsyntax(String unicodeText)
-
Field Details
-
Unicode
- See Also:
- Constant Field Values
-
htmlNamedEntity2Unicode
-
-
Constructor Details
-
StringManipulationTools
public StringManipulationTools()
-
-
Method Details
-
stringReplace
Replace occurrences of a substring. http://ostermiller.org/utils/StringHelper.html StringHelper.replace("1-2-3", "-", "|");
result: "1|2|3"
StringHelper.replace("-1--2-", "-", "|");
result: "|1||2|"
StringHelper.replace("123", "", "|");
result: "123"
StringHelper.replace("1-2---3----4", "--", "|");
result: "1-2|-3||4"
StringHelper.replace("1-2---3----4", "--", "---");
result: "1-2----3------4"- Parameters:
s- String to be modified.find- String to find.replace- String to replace.- Returns:
- a string with all the occurrences of the string to find replaced.
- Throws:
NullPointerException- if s is null.
-
removeHTMLtags
-
removeTags
-
removeTagsGetTextAndRemovedTexts
public static ArrayList<String> removeTagsGetTextAndRemovedTexts(String textWithHtmlTags, String tagA, String tagB)Removes the tags from a html-text and gives back the striped text.- Parameters:
textWithHtmlTags- the text with html tagstagA- The left tag (e.g. )tagB- The right tag (e.g. )- Returns:
- The array list< string>, where get(0) is the striped text and all other are the striped texts
-
getWordWrap
-
getWordWrap
-
removeNumbersFromString
-
getNumbersFromString
-
getAllNumbersFromString
-
UnicodeToURLsyntax
-
UnicodeToHtml
-
UnicodeToHtml
-
htmlToUnicode
- Parameters:
html-- Returns:
-
htmlNamedEntities2Unicode
converts all HTML named entities within a string to unicode- Parameters:
html-- Returns:
- unicode string
-
getFileSystemName
-
getStringList
-
splitSafe
-
reverse
-