• Right Justify

    From DesotoFireflite@VERT/VALHALLA to All on Mon Dec 28 10:28:46 2020
    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.ããSysOp: C.G. Learn, AKA: DesotoFirefliteãValhalla Home Services! - (Synchronet) - bbs.valhallabbs.comãValhalla II! - (GAP) - bbs.valhallabbs.com:24ãA Gamers Paradise - Over 150 Registered Online Game Doors!ããHome Of Odin's Maze Game Server!ãCome Play Trade Wars On Valhalla's T.W.G.S!ãã--- SENILE.COM found...Out of Memory...ã þ Synchronet þ Valhalla Home Services þ USA þ http://valhalla.synchro.netã
  • From Nightfox@VERT/DIGDIST to DesotoFireflite on Mon Dec 28 13:06:06 2020
    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ã
  • From Digital Man@VERT to DesotoFireflite on Mon Dec 28 14:37:08 2020
    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ã
  • From DesotoFireflite@VERT/VALHALLA to Nightfox on Mon Dec 28 18:28:22 2020
    Re: Right Justifyã By: Nightfox to DesotoFireflite on Mon Dec 28 2020 01:06 pmãã Ni> I don't know what formatString() is, as it doesn't seem to appear in theã Ni> Synchronet JavaScript object model - but you can use the printf() functionã Ni> to justify text. For format specifiers, text is right-justified by defaultã Ni> with printf. You may need to specify a field width though (I don'tã Ni> remember for sure off the top of my head) You could use something likeã Ni> this (with a field width of 4): ãã Ni> printf("\1h\1c%4d \1h\1c%4d", tlogons, firstOn);ããthanks, I will give that a shot, and see what happens. Again, thanksããSysOp: C.G. Learn, AKA: DesotoFirefliteãValhalla Home Services! - (Synchronet) - bbs.valhallabbs.comãValhalla II! - (GAP) - bbs.valhallabbs.com:24ãA Gamers Paradise - Over 150 Registered Online Game Doors!ããHome Of Odin's Maze Game Server!ãCome Play Trade Wars On Valhalla's T.W.G.S!ãã--- FART(n): An audio test of one's waste-disposal system.ã þ Synchronet þ Valhalla Home Services þ USA þ http://valhalla.synchro.netã
  • From DesotoFireflite@VERT/VALHALLA to Digital Man on Tue Dec 29 14:40:10 2020
    Re: Right Justifyã By: Digital Man to DesotoFireflite on Mon Dec 28 2020 02:37 pmãã DM> var lastCallerStr = format("\1h\1c%5u \1h\1c%5u", tlogons, firstOn);ãã DM> That print the integers ('u' means unsigned integer) right-justified to 5ã DM> characters (minimum), using spaces for padding. If you wanted 0-paddingã DM> instead, then you'd specify "%05u". If you want left-justification, useã DM> "%-5u". -- ããThanks RobããSysOp: C.G. Learn, AKA: DesotoFirefliteãValhalla Home Services! - (Synchronet) - bbs.valhallabbs.comãValhalla II! - (GAP) - bbs.valhallabbs.com:24ãA Gamers Paradise - Over 150 Registered Online Game Doors!ããHome Of Odin's Maze Game Server!ãCome Play Trade Wars On Valhalla's T.W.G.S!ãã--- CAT (n.), Furry keyboard cover.ã þ Synchronet þ Valhalla Home Services þ USA þ http://valhalla.synchro.netã
  • From DesotoFireflite@VERT/VALHALLA to Digital Man on Tue Dec 29 16:44:34 2020
    Re: Right Justifyã By: Digital Man to DesotoFireflite on Mon Dec 28 2020 02:37 pmãã DM> var lastCallerStr = format("\1h\1c%5u \1h\1c%5u", tlogons, firstOn);ãã DM> That print the integers ('u' means unsigned integer) right-justified to 5ã DM> characters (minimum), using spaces for padding. If you wanted 0-paddingã DM> instead, then you'd specify "%05u". If you want left-justification, useã DM> "%-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 :(ãã ããSysOp: C.G. Learn, AKA: DesotoFirefliteãValhalla Home Services! - (Synchronet) - bbs.valhallabbs.comãValhalla II! - (GAP) - bbs.valhallabbs.com:24ãA Gamers Paradise - Over 150 Registered Online Game Doors!ããHome Of Odin's Maze Game Server!ãCome Play Trade Wars On Valhalla's T.W.G.S!ãã--- Don't eat the yellow snow!ã þ Synchronet þ Valhalla Home Services þ USA þ http://valhalla.synchro.netã
  • From Digital Man@VERT to DesotoFireflite on Tue Dec 29 15:15:12 2020
    Re: Right Justifyã By: DesotoFireflite to Digital Man on Tue Dec 29 2020 04:44 pmãã > Re: Right Justifyã > By: Digital Man to DesotoFireflite on Mon Dec 28 2020 02:37 pmã >ã > DM> var lastCallerStr = format("\1h\1c%5u \1h\1c%5u", tlogons, firstOn);ã >ã > DM> That print the integers ('u' means unsigned integer) right-justified toã > DM> 5 characters (minimum), using spaces for padding. If you wantedã > DM> 0-padding instead, then you'd specify "%05u". If you wantã > DM> 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ã-- ã digital manããSynchronet/BBS Terminology Definition #33:ãFTN = FidoNet Technology NetworkãNorco, CA WX: 57.3øF, 43.0% humidity, 11 mph ESE wind, 0.53 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From DesotoFireflite@VERT/VALHALLA to Digital Man on Wed Dec 30 15:38:57 2020
    Re: Right Justifyã By: Digital Man to DesotoFireflite on Tue Dec 29 2020 03:15 pmãã DM> You would use %s instead of %u:ããThat was the ticket, thanks so much for putting up with all my stupid questions and such. I'm trying to learn the code by doing and practicing, but not always successful in my endevors, I haven't nailed down the node thing, that I asked about last week, but I'm still trying. Anyway, thanks for putting up with me.ãã DM> https://en.wikipedia.org/wiki/Printf_format_stringããThis site helped me alot, thanks for pointing it out to me.ããAgain, Thanks for all you do.... ããSysOp: C.G. Learn, AKA: DesotoFirefliteãValhalla Home Services! - (Synchronet) - bbs.valhallabbs.comãValhalla II! - (GAP) - bbs.valhallabbs.com:24ãA Gamers Paradise - Over 150 Registered Online Game Doors!ããHome Of Odin's Maze Game Server!ãCome Play Trade Wars On Valhalla's T.W.G.S!ãã--- Old farts never die! They just smell that way...ã þ Synchronet þ Valhalla Home Services þ USA þ http://valhalla.synchro.netã