Package ubic.gemma.core.util
Class StringUtils
java.lang.Object
ubic.gemma.core.util.StringUtils
Various utilities for manipulating strings.
This is mean to extend missing functionality in StringUtils.
- Author:
- poirigui
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringabbreviateInBytes(String value, String abbrevMarker, int maxLengthInBytes, boolean stripBeforeAddingMarker, Charset charset) Abbreviate the value of a field stored with the given charset if it exceeds a certain length in bytes.static StringabbreviateInBytes(String value, String abbrevMarker, int maxLengthInBytes, Charset charset) Abbreviate the value of a field stored with the given charset if it exceeds a certain length in bytes.static StringabbreviateWithSuffix(String value, String suffix, String abbrevMarker, int maxLengthInBytes, boolean stripBeforeAddingMarker, Charset charset) Abbreviate a string with a suffix as perabbreviateInBytes(String, String, int, boolean, Charset).static StringappendWithDelimiter(String s, String suffix) static StringappendWithDelimiter(String s, String suffix, String delimiter) Append a suffix to a string, with a delimiter if the string is not empty.static StringtruncateInBytes(String s, int maxBytes, Charset charset)
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
abbreviateInBytes
@Nullable public static String abbreviateInBytes(@Nullable String value, String abbrevMarker, int maxLengthInBytes, Charset charset) Abbreviate the value of a field stored with the given charset if it exceeds a certain length in bytes.- See Also:
-
abbreviateInBytes
@Nullable public static String abbreviateInBytes(@Nullable String value, String abbrevMarker, int maxLengthInBytes, boolean stripBeforeAddingMarker, Charset charset) Abbreviate the value of a field stored with the given charset if it exceeds a certain length in bytes.- Parameters:
stripBeforeAddingMarker- if true, the string will be stripped before adding the marker- See Also:
-
abbreviateWithSuffix
public static String abbreviateWithSuffix(@Nullable String value, String suffix, String abbrevMarker, int maxLengthInBytes, boolean stripBeforeAddingMarker, Charset charset) Abbreviate a string with a suffix as perabbreviateInBytes(String, String, int, boolean, Charset).This produce strings of the form:
some text{abbrevMarker}suffixsuch that the length of the string in bytes is at most the given maximum. -
truncateInBytes
- See Also:
-
appendWithDelimiter
-
appendWithDelimiter
Append a suffix to a string, with a delimiter if the string is not empty.If the string already ends with the delimiter, the suffix is appended directly.
-