StringUtils.abbreviate("abcdefg", ".", 3) = IllegalArgumentException StringUtils.abbreviate("abcdefg", ".", 2) = IllegalArgumentException StringUtils.abbreviate("abcdefg", ".", 3) = "a." StringUtils.abbreviate("abcdefg", ".", 4) = "ab." StringUtils.abbreviate("abcdefg", ".", 8) = "abcdefg" StringUtils.abbreviate("abcdefg", ".", 7) = "abcdefg" StringUtils.abbreviate("abcdefg", ".", 5) = "abcd." StringUtils.abbreviate("abcdefg", null, *) = "abcdefg" StringUtils.abbreviate(null, ".", *) = null If maxWidth is less than abbrevMarker.length + 1, throw an.Else abbreviate it to (substring(str, 0, max-abbrevMarker.length) + abbrevMarker)."Now is the time for all good men" into "Now is the time for." if "." was defined Parameters: str - the String to check, may be null offset - left edge of source String maxWidth - maximum length of result String, must be at least 4 Returns: abbreviated String, null if null String input Throws: IllegalArgumentException - if the width is too small Since: 2.0Ībbreviates a String using another given String as replacement marker. StringUtils.abbreviate("abcdefghij", 5, 6) = IllegalArgumentException StringUtils.abbreviate("abcdefghij", 0, 3) = IllegalArgumentException StringUtils.abbreviate("abcdefghijklmno", 12, 10) = ".ijklmno" StringUtils.abbreviate("abcdefghijklmno", 10, 10) = ".ijklmno" StringUtils.abbreviate("abcdefghijklmno", 8, 10) = ".ijklmno" StringUtils.abbreviate("abcdefghijklmno", 6, 10) = ".ghij." StringUtils.abbreviate("abcdefghijklmno", 5, 10) = ".fghi." StringUtils.abbreviate("abcdefghijklmno", 4, 10) = "abcdefg." StringUtils.abbreviate("abcdefghijklmno", 1, 10) = "abcdefg." StringUtils.abbreviate("abcdefghijklmno", 0, 10) = "abcdefg." StringUtils.abbreviate("abcdefghijklmno", -1, 10) = "abcdefg." StringUtils.abbreviate(null, *, *) = null In no case will it return a String of length greater than Note that this left edge is not necessarily going toīe the leftmost character in the result, or the first character following theĮllipses, but it will appear somewhere in the result. Works like abbreviate(String, int), but allows you to specifyĪ "left edge" offset. "Now is the time for all good men" into ".is the time for."
0 Comments
Leave a Reply. |