Class KeywordsHighlight

java.lang.Object
org.dlese.dpc.dds.KeywordsHighlight

public final class KeywordsHighlight extends Object
Provide highlighting of keywords in any given string of text.
Author:
ryandear
  • Constructor Details

    • KeywordsHighlight

      public KeywordsHighlight(String words, String highlightColor, String cssClassName)
      Parse keyword input string and populate keywords array
      Parameters:
      words - The new keywords input value
      highlightColor -
  • Method Details

    • 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