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 inserting literal string values in the 
appropriate places. Some may not see the need for this, or can thing of one off 
methods for doing each of these. So can I. I just don't like solving a problem 
over and over, and once solved I like to share that with others. 

As I said, Excel does this pretty well. I just need to mimic what they are 
doing. The trick would be to find the start and end character of actual numeric 
values in a string and replace them with reformatted versions in the format 
string. So "   1.55" with a format string of "00.000%" would return "01.550%" 
(not that you would need that, but you get the point.) 

Bob S


> On Apr 6, 2017, at 11:13 , hh via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> 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.33333, you get $5.33
>>> 
>>> want a space between the $, then use
>>> put format("$ %0.2f",tMoney) into msg
>>> 
>>> want a leading zero and minimum of 2 digits before the decimal point
>>> put format("$ %05.2f",5.553) into msg
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to