Virtual Private Server (VPS) Hosting provided by Central Point Networking cpnllc.com
For some reason, the "Nodelist" and "Recent Callers" features are not working.
Sysop: | Ray Quinn |
---|---|
Location: | Visalia, CA |
Users: | 56 |
Nodes: | 10 (0 / 10) |
Uptime: | 148:20:22 |
Calls: | 9 |
Files: | 12,168 |
Messages: | 150,869 |
Check out the US 99 menu above for links to information about US Highway 99, after which the US 99 BBS is named.
Be sure to click on the Amateur Radio menu item above for packet BBSes, packet software, packet organizations, as well as packet how-to's. Also included is links to local and some not-so-local Amateur Radio Clubs.
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
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.
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);
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". --
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". --
Re: Right Justify
By: Digital Man to DesotoFireflite on Mon Dec 28 2020 02:37 pm
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". --
Ok, I think I got that, and I have managed to make it work with different colors for anything that uses strictly numbers, but lets say there is a alias field, and a date field, if I use the u, which applies to intergers, I get <error> in the field, and if I leave out the padding and justifaction, I get a blank screen.
var lastCallerStr = format("\1h\1c%5u \1h\1r%2u \1h\1g%2u", tlogons, age, sec);
The above works as is, but what would I use instead of a u to format the alias and a date field with color. I tried to find the answer on my own looking at the js object model, but no luck. I guess what do i use in place of the u for text and dates.
var lastCallerStr = "\1h\1b" + alias + " " + "\1h\1y" + lastOn;
Thanks, as always. I beginning to think, that this is way over my head :(
You would use %s instead of %u:
https://en.wikipedia.org/wiki/Printf_format_string