collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Padding or adding spaces to varable output  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Padding or adding spaces to varable output
« on: October 14, 2007, 03:15:37 am »
I know this was brought up before.  and I know I did something like this before also, but I can not find it, and I believe that someone else actually made a better way of doing this anyway.  What I would like to find/request or what ever is something to line up text in a blob.

8  test1 output
9  test321 output
10  test438 output

I would like to see this as

8    test1     output
9    test321  output
10  test438   output

even that would look better, but I know there was a better way of doing it with out using spaces.   Would actually like to have a module actually made for this.

$this -> bot -> space(0, $var[4], 8)

The 8 would be the total length of the variable, and it would take that variable and pad it at the beginning, or you could move the 8 to the end and put a 0 in the beginning to add the padding to the end.

not sure really.. but it would be nice.
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Padding or adding spaces to varable output
« Reply #1 on: October 14, 2007, 10:36:41 am »
You can use sprintf() to format the output, including enforcing minimum length for any variables.

But you cannot be certain that everyone is using the same font under AO, or that the font used is a fixed width font. The best you can do is fit the formatting for your configuration. As sadly AO doesn't support tables in their pseudo-html code for blobs.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 211
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal