Subj : Right Justify
To : DesotoFireflite
From : Digital Man
Date : Mon Dec 28 2020 02:37 pm
Re: Right Justify
By: DesotoFireflite to All on Mon Dec 28 2020 10:28 am
> Is there a way for me to right justify the output of a file for a bulletin.
> Im using the below to get the stats, and it's just part of the total file.
>
> var tlogons = formatString(users[i].stats.total_logons, 5);
>
> var lastCallerStr = "\1h\1c" + tlogons + " " + "\1h\1c" + firstOn;
>
> It displays ok, but it's left justified
> 212
> 3
> 1946
> 56
> 10214
>
> I want it to be right justified and show as
> 212
> 3
> 1946
> 56
> 10214
>
> Is there a simple way to do this. Thanks in advance.
var lastCallerStr = format("\1h\1c%5u \1h\1c%5u", tlogons, firstOn);
That print the integers ('u' means unsigned integer) right-justified to 5 characters (minimum), using spaces for padding. If you wanted 0-padding instead, then you'd specify "%05u". If you want left-justification, use "%-5u".
--
digital man
Rush quote #21:
You can surrender without a prayer, but never really pray without surrender
Norco, CA WX: 49.1�F, 89.0% humidity, 0 mph S wind, 0.49 inches rain/24hrs
---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net