Package ubic.gemma.core.util
Class StringUtils
- java.lang.Object
-
- ubic.gemma.core.util.StringUtils
-
public class StringUtils extends Object
Various utilities for manipulating strings.This is mean to extend missing functionality in
StringUtils
.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
abbreviateInBytes(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 String
abbreviateInBytes(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 String
abbreviateWithSuffix(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 String
truncateInBytes(String s, int maxBytes, Charset charset)
-
-
-
Method Detail
-
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:
StringUtils.abbreviate(String, int)
-
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:
StringUtils.abbreviate(String, int)
-
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}suffix
such that the length of the string in bytes is at most the given maximum.
-
-