1 Ax.text.Line

Class Ax.text.Line introduces features to format lines with fields with fixed length position. Ax.text.Line Constructor creates a String with size defined in first parameter and optionaly with filler sent in second parameter. Then, you can invoque method add to put content in fixed column position inside this String.

Copy
<script>
    var line = new Ax.text.Line(20)
                          .add(1, 'abc')
                          .add(2,'123')
                          .add(10, (function () { return "XYZ"; })() )
                          .toString();
    console.log("[" + line + "]");
</script>
[ a123     XYZ       ]
Copy
<script>
    var line = new Ax.text.Line(20, ' ');
    line.add(1, 'abc');
    line.add(2, '123');
    if (1==1)
       	line.add(10, 'XYZ');
    
    console.log("[" + line + "]");
</script>
[ a123     XYZ       ]