Class StringUtils


  • public class StringUtils
    extends Object
    Various utilities for manipulating strings.

    This is mean to extend missing functionality in StringUtils.

    Author:
    poirigui
    • Constructor Detail

      • StringUtils

        public StringUtils()
    • 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)
      • truncateInBytes

        public static String truncateInBytes​(String s,
                                             int maxBytes,
                                             Charset charset)
        See Also:
        StringUtils.truncate(String, int)