Swashbuckle.Core/Swagger/XmlComments/XmlTextHelper.cs
/// <summary>
/// Finds the common padding prefix used on all non-empty lines.
/// </summary>
/// <param name="lines"></param>
/// <returns>The common padding found on all non-blank lines - returns null when no common prefix is found</returns>
Finds the common padding prefix used on all non-empty lines.
Finds the common padding prefix used on all non - empty lines .
static string GetCommonLeadingWhitespace(string[] lines)
        {
            if (null == lines)
                throw new ArgumentException("lines");
            if (lines.Length == 0)
                return null;
            string[] nonEmptyLines = lines
                .Where(x => !string.IsNullOrWhiteSpace(x))
                .ToArray();
            if (nonEmptyLines.Length < 1)
                return null;
            int padLen = 0;
            string seed = nonEmptyLines[0];
            for (int i = 0, l = seed.Length; i < l; ++i)
            {
                if (!char.IsWhiteSpace(seed, i))
                    break;
                if (nonEmptyLines.Any(line => line[i] != seed[i]))
                    break;
                ++padLen;
            }
            if (padLen > 0)
                return seed.Substring(0, padLen);
            return null;
        }
static string GetCommonLeadingWhitespace ( string [ ] lines ) { if ( null == lines ) throw new ArgumentException ( " " ) ; if ( lines . Length == 0 ) return null ; string [ ] nonEmptyLines = lines . Where ( x => ! string . IsNullOrWhiteSpace ( x ) ) . ToArray ( ) ; if ( nonEmptyLines . Length < 1 ) return null ; int padLen = 0 ; string seed = nonEmptyLines [ 0 ] ; for ( int i = 0 , l = seed . Length ; i < l ; ++ i ) { if ( ! char . IsWhiteSpace ( seed , i ) ) break ; if ( nonEmptyLines . Any ( line => line [ i ] != seed [ i ] ) ) break ; ++ padLen ; } if ( padLen > 0 ) return seed . Substring ( 0 , padLen ) ; return null ; }
Finds the common padding prefix used on all non-empty lines.
Finds the common padding prefix used on all non - empty lines .
// use the first line as a seed, and see what is shared over all nonEmptyLines
The common padding found on all non-blank lines - returns null when no common prefix is found
The common padding found on all non - blank lines - returns null when no common prefix is found
lines
string[]
None