Class OpenAbbreviation
java.lang.Object
cloud.opencode.base.string.abbr.OpenAbbreviation
Abbreviation Utility - Provides string abbreviation and shortening methods.
缩写工具 - 提供字符串缩写和缩短方法。
Features | 主要功能:
- Head abbreviation with ellipsis - 头部缩写带省略号
- Middle abbreviation - 中间缩写
- Configurable offset and ellipsis - 可配置偏移和省略符
Usage Examples | 使用示例:
String abbr = OpenAbbreviation.abbreviate("Hello World", 8); // "Hello..."
String mid = OpenAbbreviation.abbreviateMiddle("abcdefgh", "...", 7); // "ab...gh"
Security | 安全性:
- Thread-safe: Yes (stateless utility) - 线程安全: 是(无状态工具类)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-string V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringabbreviate(String str, int maxLength) static Stringabbreviate(String str, int offset, int maxLength, String ellipsis) static StringabbreviateMiddle(String str, String middle, int maxLength)
-
Method Details
-
abbreviate
-
abbreviate
-
abbreviateMiddle
-