Format function on LiveCode 6.5.1
mwieder at ahsoftware.net
Thu Jan 2 22:04:30 EST 2014
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?
ahsoftware at gmail.com
More information about the Use-livecode