client/splunk.ui.charting.js
function(string, maxLength) {
            if (!string) return string;
            if (maxLength < 1) return string;
            if (string.length <= maxLength) return string;
            if (maxLength == 1) return string.substring(0,1) + '...';

            var midpoint = Math.ceil(string.length / 2);
            var toremove = string.length - maxLength;
            var lstrip = Math.ceil(toremove/2);
            var rstrip = toremove - lstrip;
            return string.substring(0, midpoint-lstrip) + '...' + string.substring(midpoint+rstrip);
        }
function(string, maxLength) {
            if (!string) return string;
            if (maxLength < 1) return string;
            if (string.length <= maxLength) return string;
            if (maxLength == 1) return string.substring(0,1) + '...';

            var midpoint = Math.ceil(string.length / 2);
            var toremove = string.length - maxLength;
            var lstrip = Math.ceil(toremove/2);
            var rstrip = toremove - lstrip;
            return string.substring(0, midpoint-lstrip) + '...' + string.substring(midpoint+rstrip);
        }
function ( string , maxLength ) { if ( ! string ) return string ; if ( maxLength < 1 ) return string ; if ( string . length <= maxLength ) return string ; if ( maxLength == 1 ) return string . substring ( 0 , 1 ) + '...' ; var midpoint = Math . ceil ( string . length / 2 ) ; var toremove = string . length - maxLength ; var lstrip = Math . ceil ( toremove / 2 ) ; var rstrip = toremove - lstrip ; return string . substring ( 0 , midpoint - lstrip ) + '...' + string . substring ( midpoint + rstrip ) ; }
Returns a string trimmed to maxLength by removing characters from the
middle of the string and replacing with ellipses.

Ex: Splunk.util.smartTrim('1234567890', 5) ==> '12...890'
Returns a string trimmed to maxLength by removing characters from the middle of the string and replacing with ellipses .