Class OpenHighlight
java.lang.Object
cloud.opencode.base.string.text.OpenHighlight
Text Highlight Utility - Provides text highlighting methods.
文本高亮工具 - 提供文本高亮方法。
Features | 主要功能:
- HTML span highlighting with CSS class - HTML span高亮带CSS类
- ANSI console color highlighting - ANSI控制台颜色高亮
- Custom prefix/suffix highlighting - 自定义前缀/后缀高亮
- Multi-keyword highlighting - 多关键词高亮
Usage Examples | 使用示例:
String html = OpenHighlight.highlightHtml("Hello World", "World");
// "Hello <span class=\"highlight\">World</span>"
Security | 安全性:
- Thread-safe: Yes (stateless utility) - 线程安全: 是(无状态工具类)
- Null-safe: Yes (returns input for null keyword) - 空值安全: 是
- Since:
- JDK 25, opencode-base-string V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic StringhighlightByPattern(String text, String pattern, String prefix, String suffix) static StringhighlightConsole(String text, String keyword, OpenHighlight.AnsiColor color) static StringhighlightHtml(String text, String keyword) static StringhighlightHtml(String text, String keyword, String cssClass)
-
Method Details
-
highlight
-
highlightHtml
-
highlightHtml
-
highlightConsole
-
highlight
-
highlightByPattern
-