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[][]
htmlNamedEntity2Unicode
static String
Unicode
-
Constructor Summary
Constructors Constructor Description StringManipulationTools()
-
Method Summary
Modifier and Type Method Description static List<Integer>
getAllNumbersFromString(String str)
static String
getFileSystemName(String name)
static String
getNumbersFromString(String s)
static String
getStringList(ArrayList<?> elements, String div)
static String
getWordWrap(String[] desc, int width)
static String
getWordWrap(String desc, int width)
static String
htmlNamedEntities2Unicode(String html)
converts all HTML named entities within a string to unicodestatic String
htmlToUnicode(String html)
static String
removeHTMLtags(String textWithHtmlTags)
static String
removeNumbersFromString(String s)
static String
removeTags(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 String
reverse(String in)
static String[]
splitSafe(String str, String delimiter)
static String
stringReplace(String s, String find, String replace)
Replace occurrences of a substring.static String
UnicodeToHtml(String unicodeText)
static String
UnicodeToHtml(String unicodeText, HashSet<Character> badChars)
static String
UnicodeToURLsyntax(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
-