DLESE Tools
v1.2

org.dlese.dpc.dds
Class KeywordsHighlight

java.lang.Object
  extended byorg.dlese.dpc.dds.KeywordsHighlight

public final class KeywordsHighlight
extends Object

Provide highlighting of keywords in any given string of text.

Author:
ryandear

Constructor Summary
KeywordsHighlight(String words, String highlightColor)
          Parse keyword input string and populate keywords array
 
Method Summary
 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.
 String highlight(String text, boolean addWbr)
          Given any string of text, return the text with all keywords highlighted.
 String replace(String in, String find)
          Perform string match and replace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeywordsHighlight

public KeywordsHighlight(String words,
                         String highlightColor)
Parse keyword input string and populate keywords array

Parameters:
words - The new keywords input value
highlightColor -
Method Detail

highlight

public String highlight(String text,
                        boolean addWbr)
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

public String replace(String in,
                      String find)
Perform string match and replace

Parameters:
in - input string
find - 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

DLESE Tools
v1.2