example/public/ueditor/third-party/SyntaxHighlighter/shCore.js
function unindent(str)
    {
        var lines = splitLines(fixInputString(str)),
            indents = new Array(),
            regex = /^\s*/,
            min = 1000
            ;

        // go through every line and check for common number of indents
        for (var i = 0; i < lines.length && min > 0; i++)
        {
            var line = lines[i];

            if (trim(line).length == 0)
                continue;

            var matches = regex.exec(line);

            // In the event that just one line doesn't have leading white space
            // we can't unindent anything, so bail completely.
            if (matches == null)
                return str;

            min = Math.min(matches[0].length, min);
        }

        // trim minimum common number of white space from the begining of every line
        if (min > 0)
            for (var i = 0; i < lines.length; i++)
                lines[i] = lines[i].substr(min);

        return lines.join('\n');
    }
function unindent(str)
    {
        var lines = splitLines(fixInputString(str)),
            indents = new Array(),
            regex = /^\s*/,
            min = 1000
            ;

        // go through every line and check for common number of indents
        for (var i = 0; i < lines.length && min > 0; i++)
        {
            var line = lines[i];

            if (trim(line).length == 0)
                continue;

            var matches = regex.exec(line);

            // In the event that just one line doesn't have leading white space
            // we can't unindent anything, so bail completely.
            if (matches == null)
                return str;

            min = Math.min(matches[0].length, min);
        }

        // trim minimum common number of white space from the begining of every line
        if (min > 0)
            for (var i = 0; i < lines.length; i++)
                lines[i] = lines[i].substr(min);

        return lines.join('\n');
    }
function unindent ( str ) { var lines = splitLines ( fixInputString ( str ) ) , indents = new Array ( ) , regex = / ^\s* / , min = 1000 ; // go through every line and check for common number of indents for ( var i = 0 ; i < lines . length && min > 0 ; i ++ ) { var line = lines [ i ] ; if ( trim ( line ) . length == 0 ) continue ; var matches = regex . exec ( line ) ; // In the event that just one line doesn't have leading white space // we can't unindent anything, so bail completely. if ( matches == null ) return str ; min = Math . min ( matches [ 0 ] . length , min ) ; } // trim minimum common number of white space from the begining of every line if ( min > 0 ) for ( var i = 0 ; i < lines . length ; i ++ ) lines [ i ] = lines [ i ] . substr ( min ) ; return lines . join ( '\n' ) ; }
Unindents a block of text by the lowest common indent amount.
@param {String} str   Text to unindent.
@return {String}      Returns unindented text block.
Unindents a block of text by the lowest common indent amount .