LC converts phone number to scientific notation
Mark Waddingham
mark at livecode.com
Sat Sep 10 02:55:20 EDT 2022
On 2022-09-09 11:40, Klaus major-k via use-livecode wrote:
> Hi Panos,
>
>> Am 09.09.2022 um 12:27 schrieb panagiotis m via use-livecode
>> <use-livecode at lists.runrev.com>:
>>
>> Hello Klaus,
>>
>> I guess what happens here is that if you fetch item X of line Y and
>> use it
>> directly, LC treats it as a number and displays it in scientific
>> notation.
>
> obviously!
Panos isn't correct here...
None of the code you posted would cause a string to be converted to a
number - the engine only does that when you pass a string to something
which expects a number (and returns one).
Specifically the 'item' chunk is a string chunk - it just manipulates
fetches or stores sequences of characters into other sequences of
characters.
So the problem you are having is elsewhere - and not in the code which
reorders the strings of the lines you have imported.
It is either happening when you import the data, or when you are
displaying it.
Indeed, LCS doesn't use scientific notation when converting numbers to
strings implicitly - you need to use `format()` to get numbers in that
string form.
However, LCB *does* use scientific format when converting numbers to
strings (currently at least - we've got an item on the todo list to
improve that behavior). For example, the variable viewer in the SE is a
treeview widget, so if a variable holds a number that will display in
scientific notation if it has above a certain number of significant
digits.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list