}
/**
+ * Return an abbreviated string, with characters in the middle of the
+ * excesively long string replaced by '...'.
+ *
+ * @param string $text The original string.
+ * @param integer $length The length at which to abbreviate.
+ *
+ * @return string The abbreviated string, if longer than $length.
+ */
+ static public function abbreviate($text, $length = 20)
+ {
+ return (self::length($text) > $length)
+ ? self::substr($text, 0, round(($length - 3) / 2)) . '...' . self::substr($text, (($length - 3) / 2) * -1)
+ : $text;
+ }
+
+ /**
* Returns true if the every character in the parameter is an alphabetic
* character.
*
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>
+ <notes>* Added Horde_Util::abbreviate().
* Removed Horde_Array::combine() and Horde_Util::hmac().
* Initial Horde 4 package.
</notes>