Subj : Right Justify
To   : DesotoFireflite
From : Nightfox
Date : Mon Dec 28 2020 01:06 pm

 Re: Right Justify
 By: DesotoFireflite to All on Mon Dec 28 2020 10:28 am

De> Is there a way for me to right justify the output of a file for a
De> bulletin. Im using the below to get the stats, and it's just part of the
De> total file.

De> var tlogons = formatString(users[i].stats.total_logons, 5);

De> var lastCallerStr = "\1h\1c" + tlogons + " " + "\1h\1c" + firstOn;

De> It displays ok, but it's left justified
De> 212
De> 3
De> 1946

I don't know what formatString() is, as it doesn't seem to appear in the
Synchronet JavaScript object model - but you can use the printf() function to
justify text.  For format specifiers, text is right-justified by default with
printf.  You may need to specify a field width though (I don't remember for sure off the top of my head)  You could use something like this (with a field width of 4):

printf("\1h\1c%4d \1h\1c%4d", tlogons, firstOn);

And if you're curious, if you really wanted to left-justify those, you'd use a
- after the % sign:

printf("\1n\1c%-4d \1h\1c%-4d", tlogons, firstOn);

Also, as a side note, the 2nd \1h\1c is extraneous in the string you're
printing, as the string already has the high and cyan attributes at that point.

Nightfox

---
� Synchronet � Digital Distortion: digitaldistortionbbs.com