示例#1
0
        public static string ContingentLines(
            this IReadOnlyList <string> lines,
            string delim = LF,
            byte level   = 0,
            Brac brac    = Brac.NAN
            )
        {
            var edged  = brac != Brac.NAN;
            var joined = lines.Any() && LINEFEED.IsMatch(delim)
        ? edged
          ? lines.JoinLinesEdged(COMMA.IsMatch(delim) ? CO : "", level)
          : lines.JoinLines(COMMA.IsMatch(delim) ? CO : "", level)
        : lines.Join(delim);

            return(joined.Br(brac));
        }
示例#2
0
        public static string Br(this string text, Brac brac)
        {
            switch (brac)
            {
            case Brac.PAR: return("(" + text + ")");

            case Brac.BRK: return("[" + text + "]");

            case Brac.BRC: return("{" + text + "}");

            case Brac.ANG: return("<" + text + ">");

            case Brac.NAN: return(text);

            default: return(text);
            }
        }