Exemplo n.º 1
0
        public static PrettyString ConcatLines(int Zero, PrettyString A, PrettyString B)
        {
            int    cols = Math.Max(A.ColumnCount, B.ColumnCount);
            string padA = new string(' ', (cols - A.ColumnCount) / 2);
            string padB = new string(' ', (cols - B.ColumnCount) / 2);

            return(new PrettyString(Zero, A.Lines.Select(i => padA + i).Concat(B.Lines.Select(i => padB + i))));
        }
Exemplo n.º 2
0
        public static PrettyString ConcatColumns(PrettyString L, PrettyString R)
        {
            int l0 = Math.Min(-L.ZeroRow, -R.ZeroRow);
            int l1 = Math.Max(L.LineCount - L.ZeroRow, R.LineCount - R.ZeroRow);

            IEnumerable <string> linesL = Enumerable.Repeat("", -L.ZeroRow - l0).Concat(L.Lines).Concat(Enumerable.Repeat("", l1 - (L.LineCount - L.ZeroRow)));
            IEnumerable <string> linesR = Enumerable.Repeat("", -R.ZeroRow - l0).Concat(R.Lines).Concat(Enumerable.Repeat("", l1 - (R.LineCount - R.ZeroRow)));

            int cols = L.ColumnCount;

            return(new PrettyString(-l0, linesL.Zip(linesR, (i, j) => i + new string(' ', cols - i.Length) + j)));
        }
Exemplo n.º 3
0
 public static PrettyString ConcatColumns(PrettyString L, PrettyString M, PrettyString R)
 {
     return(ConcatColumns(L, ConcatColumns(M, R)));
 }