Package org.dlese.dpc.dds
Class KeywordsHighlight
java.lang.Object
org.dlese.dpc.dds.KeywordsHighlight
Provide highlighting of keywords in any given string of text.
- Author:
- ryandear
-
Constructor Summary
ConstructorsConstructorDescriptionKeywordsHighlight(String words, String highlightColor, String cssClassName) Parse keyword input string and populate keywords array -
Method Summary
Modifier and TypeMethodDescriptionintGets the firstHighlightIndex attribute of the KeywordsHighlight object--when keyword highlighting is performed, firstHighlightIndex is loaded with the index of the first occurrence of a keyword within the given string.Given any string of text, return the text with all keywords highlighted.Perform string match and replace
-
Constructor Details
-
KeywordsHighlight
Parse keyword input string and populate keywords array- Parameters:
words- The new keywords input valuehighlightColor-
-
-
Method Details
-
highlight
Given any string of text, return the text with all keywords highlighted.- Parameters:
text-addWbr- if true, replace '/' with '/' (allows URLs to wrap) - Returns:
- DESCRIPTION
-
replace
Perform string match and replace- Parameters:
in- input stringfind- string to match against- Returns:
- the newly altered string
-
getFirstHighlightIndex
public int getFirstHighlightIndex()Gets the firstHighlightIndex attribute of the KeywordsHighlight object--when keyword highlighting is performed, firstHighlightIndex is loaded with the index of the first occurrence of a keyword within the given string.- Returns:
- The firstHighlightIndex value
-