Format function on LiveCode 6.5.1

Scott Rossi scott at
Thu Jan 2 23:40:20 EST 2014

Hi Mark:

On my end, I've been using the following "incantation" of format for years
to pad numbers with zeros.  I assume the entry in the Linux dictionary
would show this, but on OSX/Win, it reads as follows:

"If a zero is included immediately before the charLength parameter in any
formatting incantation that allows padding, the resulting value is padded
(if necessary) with zeroes instead of spaces. For example, the incantation
%03s transforms H to 00H."

So if a string is NOT being padded with 0's, perhaps this is a Linux bug?

I believe this is where Alejandro's question came from.


Scott Rossi
Creative Director
Tactile Media, UX/UI Design

On 1/2/14 7:04 PM, "Mark Wieder" <mwieder at> wrote:

>Thursday, January 2, 2014, 3:21:06 PM, you wrote:
>> Hi All,
>> Could you post your results of these code snippets?
>> Write in the message box:
>> put format("%04s",17)
>> Write down the result and test this:
>> put format("%04d",17)
>> Post both results, your LiveCode version
>> and your Operating System.
>The documentation is a bit ambiguous on this, but I believe the linux
>implementation does the right thing (my results agree with Martin's,
>in that the result of 17 is padded with two leading spaces). The OSX
>implementation just seems wrong to me.
>From the documentation:
>The corresponding value is unchanged, except that if a charLength is
>specified, if the string is shorter than the charLength, enough
>leading spaces are added to make it charLength characters long. If the
>length of the string is equal to or greater than the charLength, it is
>unchanged. For example, the incantation %3s transforms "H" to "  H".
>What are you wanting to happen here?
>-Mark Wieder
> ahsoftware at

More information about the Use-livecode mailing list