BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Module Requests => Topic started by: Nytridr on October 14, 2007, 03:15:37 am

Title: Padding or adding spaces to varable output
Post by: Nytridr 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.
Title: Re: Padding or adding spaces to varable output
Post by: Alreadythere on October 14, 2007, 10:36:41 am
You can use sprintf() (http://php.net/manual/en/function.sprintf.php) 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.
SimplePortal 2.3.7 © 2008-2024, SimplePortal