Oh that is interesting. Each number has to be a separate argument. That is
something I did not glean from reading the docs a while back.
Bob S
On Apr 6, 2017, at 14:26 , Paul Dupuis via use-livecode
mailto:use-livecode@lists.runrev.com>> wrote:
put format("%03d.%03d.%03d.%03d",192,168,1,1) pr
On 4/6/2017 5:04 PM, Bob Sneidar via use-livecode wrote:
> put format("00:00:00", "9:50:00") produces 00:00:00.
> put format("##:##:##", "9:50:00") produces ##:##:##.
> put format("nnn.nnn.nnn.nnn", "192.168.1.1") produces nnn.nnn.nnn.nnn
put format("%2d:%02d:%02d", 9,50,0) produces 9:50:00
put
put format("00:00:00", "9:50:00") produces 00:00:00.
put format("##:##:##", "9:50:00") produces ##:##:##.
put format("nnn.nnn.nnn.nnn", "192.168.1.1") produces nnn.nnn.nnn.nnn
Point being, format is great for formatting NUMBERS, not converting truncated
numeric values in between delimiters or i
Okay,
put format("$ %05.2f",-5.553) into msg
gives $ -5.55
I am sure there is some formatting someone would want that can not be
done with the format function, but most can and without spending the
time to exhaustively test, I suspect that anything you can do with
numberFormat you can do with for
You forgot to give examples for Bob's original problem?
The negative numbers ... ;-)
> Paul D. wrote:
>> put format("$%0.2f",tMoney) into msg
>>
>> for tMoney = 5.55, you get $5.55
>> for tMoney = 5.3, you get $5.33
>>
>> want a space between the $, then use
>> put format("$ %0.2f",tMoney)
I am curious why folks use numberFormat vs the format function (which is
much more consistent and versatile). Is the issue the complexity of the
formatting strings for the format function?
put format("$%0.2f",tMoney) into msg
for tMoney = 5.55, you get $5.55
for tMoney = 5.3, you get $5.33
w
I already have some functions for formatting numerical values I can submit for
review. formatDate() is already in the masterLibrary.
function formatMoney theValue
-- strip out monetary symbols
replace "$" with empty in theValue
replace "ยข" with empty in theValue
switch
case the
Paul Dupuis wrote:
> On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote:
>>
>> Confirmed - running this script in v9dp6 and again all the way back
>> in v6.0:
>>
>> on mouseUp
>>set the numberformat to "###.###"
>>put 2.5 + 2.5 into x
>>set the numberformat to "000.000"
>>pu
I've created a monster. All the more reason to depricate numberformat and go
with some kind of formatNumber() function like Excel has. I'll have a go today
sometime.
Bob S
> On Apr 5, 2017, at 17:27 , Paul Dupuis via use-livecode
> wrote:
>
> On 4/5/2017 7:42 PM, J. Landman Gay via use-liv
On 4/5/2017 7:42 PM, J. Landman Gay via use-livecode wrote:
> On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote:
>> Jacque wrote:
>>
>>> HyperCard distinguished between "#" and "0" and produced different
>>> results. It sounds like LC doesn't?
>>
>> Confirmed - running this script in v9dp6 a
On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote:
Jacque wrote:
HyperCard distinguished between "#" and "0" and produced different
results. It sounds like LC doesn't?
Confirmed - running this script in v9dp6 and again all the way back in
v6.0:
on mouseUp
set the numberformat to "#
Jacque wrote:
> HyperCard distinguished between "#" and "0" and produced different
> results. It sounds like LC doesn't?
Confirmed - running this script in v9dp6 and again all the way back in
v6.0:
on mouseUp
set the numberformat to "###.###"
put 2.5 + 2.5 into x
set the numberformat
On 4/5/17 2:07 PM, Mark Waddingham via use-livecode wrote:
I should say the bit of engine code which does parsing and
application of the numberformat has been left untouched in terms of
what it does for as long as I can remember... It is one of those
places where a subtle change could break apps
Yup. I have thought for a long time that there should be a formatNumber()
function that did almost exactly what Excel does in terms of formatting a
number. I will have to look into that. I'll post it if I throw one together.
Should be easy given the string operations LC is capable of.
Bob S
O
I should say the bit of engine code which does parsing and application of the
numberformat has been left untouched in terms of what it does for as long as I
can remember... It is one of those places where a subtle change could break
apps quite easily as it is somewhat hard to see precisely what
On 2017-04-05 20:28, Bob Sneidar via use-livecode wrote:
And here is an oddity again. In the dictionary, there is no mention of
spaces or any other character besides "0.#" being valid in a
numberformat string, but:
set the numberformat to " 00";put -09+0 & ":" & 00+0 & ":" & 00+0
produces -09:0
And here is an oddity again. In the dictionary, there is no mention of spaces
or any other character besides "0.#" being valid in a numberformat string, but:
set the numberformat to " 00";put -09+0 & ":" & 00+0 & ":" & 00+0
produces -09:000:000
In fact, you can put ANYTHING in place of a 0, and
That was my point, that the sign should not take up one of the digits in
numberformat 00. And thank you for your explanation about strings being strings
until math was done on them. In my timeCalc() function however, I already
convery everything to seconds and just before conatenating HH, MM and
On 2017-04-05 19:21, Mark Waddingham via use-livecode wrote:
The latter bit about 'not being able to do arithmetic' might sound odd
but it is
a reflection of the finiteness of computers.
Just correcting myself: 'finiteness of computers' was the wrong thing to
say
here - if you can represent a
On 2017-04-03 19:11, Bob Sneidar via use-livecode wrote:
Was anyone aware that the sign takes up one of the digital in number
format? For instance,
set the numberformat to "00";put -1 +0 & ":" & 0 +0 & ":" & 0 +0
returns:
-1:00:00
but
set the numberformat to "00";put -12 +0 & ":" & 0 +0 & ":" &
Never mind.
Bob S
> On Apr 4, 2017, at 13:12 , hh via use-livecode
> wrote:
>
Bob S. wrote:
You should rather say the number format determines the num of DIGITS.
>>> hh wrote:
>>> That's what you wish to have (good idea). But it's not like that, its
>>> the length of the number
>>> Bob S. wrote:
>>> You should rather say the number format determines the num of DIGITS.
>> hh wrote:
>> That's what you wish to have (good idea). But it's not like that, its
>> the length of the number as string.
> Bob S. wrote
> Really? Then why does :
> set the numberformat to 0.0; put -.
Really? Then why does :
set the numberformat to 0.0;put -.1 + 0
result in
-0.1
?
Bob S
> On Apr 3, 2017, at 16:55 , hh via use-livecode
> wrote:
>
>> You should rather say the number format determines the num of DIGITS.
>
> That's what you wish to have (good idea). But it's not like that,
> Bob S. worte:
> I have a function for calculating the difference in time
Then you mean -(01:00:00) and not (-01):(00):(00), quite different.
AFAIK most languages do such time evaluations as follows
1) compute the time in seconds,
2) convert its absolute value to time format, and
3) if negative,
The time format is irrelevant. It just so happens I have a function for
calculating the difference in time, and when the first character is a - I know
the end time is earlier than the start time, which was what I was checking for.
And I think you are mistaken. numberFormat sets the format for n
TMHO, this could be a feature request rather than a bug report.
The zeros in the number format determine the num of characters
and "-" is one.
Also we have -0 = 0. So what about "-01:-00:-00" ??
> Bob S. wrote:
> "-01:00:00"?
> Yes I expected this. It's not that I cannot work around it,
> it's ju
Yes I expected this. It's not that I cannot work around it, it's just that it
seems it ought to put 2 zeros where 2 zeros are specified in the numberFormat
and if it doesn't and should, then I will file an (admittedly low priority) bug
report.
Bob S
> On Apr 3, 2017, at 10:16 , dunbarx via u
ect:
-01:00:00
Craig Newman
--
View this message in context:
http://runtime-revolution.278305.n4.nabble.com/Negative-Numbers-and-NumberFormat-tp4713609p4713610.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-livecode
Was anyone aware that the sign takes up one of the digital in number format?
For instance,
set the numberformat to "00";put -1 +0 & ":" & 0 +0 & ":" & 0 +0
returns:
-1:00:00
but
set the numberformat to "00";put -12 +0 & ":" & 0 +0 & ":" & 0 +0
returns:
-12:00:00
Does no one else find that odd
29 matches
Mail list logo