as a work around:
$Loc:=position("."; imported_Text_Number)
$Text_Integer:=substring($imported_Text_Number;1;$Loc-1)
$Integer:=Num($Text_Integer)
$Text_Integer:=substring(imported_Text_Number;$Loc+1)
$Decimal:=num($Text_Integer)
$Final_Value:=$Integer+($Decimal/(10*length($Text_Integer)))

Given "1234.5678" the above should give you
Integer=1234
$Decimal:=5678
$Final_Value=1234.5678

Please note: all of the above code typed in email 

On Tue, 12 Dec 2017 23:13:20 +0000, Peter Mew via 4D_Tech wrote:
> The imported file is always a string and the part I need is always a
> substring that looks like "123456.1234567890"
> The decimal separator is always a period
> The num function needs to work on systems that have either the period or
> the comma, as the native decimal separator
> thanks
> -pm
> 
> On Tue, Dec 12, 2017 at 10:19 PM, Charles Miller via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> If this is always a long why is the striking XXXX.XX or XXXX,XX
>> It might be simpler but I would first doa substrinmg from 1 to position of
>> either , or . and then a num on that.
>> You will have to identify what system you are on and what localization is
>> set to and then understand what localization created text file for import
>> 
>> 
>> Regards
>> 
>> Chuck
>> 
>> On Tue, Dec 12, 2017 at 4:24 PM, Peter Mew via 4D_Tech <
>> 4d_tech@lists.4d.com
>>> wrote:
>> 
>>> Hi
>>> I thought I had this understood, but aparrently not.
>>> Im Importing some numbers from a file as strings.The Numbers have a
>> period
>>> as decimal point.
>>> Because they are long decimal numbers and I need to do some calculations
>> I
>>> convert them to longints with NUM()
>>> everything works fine on a UK system that has its decimal point as a
>> period
>>> When I run on a German system that has its a comma as its decimal point
>> the
>>> conversion screws up
>>> So I tried using NUM(string;".") as the conversion (I thought, to force
>> the
>>> Decimal point to be a period)
>>> but this seems to make no difference as the conversion,  is still
>> sccrewed
>>> up.
>>> Could Someone point me in the direction of what I've misunderstood.
>>> Thanks
>>> -pm
>>> Im testing this by changing the localisation on the mac to German, and
>>> comma as the decimal point.
>>> Mac OS 10.10.5 4D v13.6
>>> **********************************************************************
>>> 4D Internet Users Group (4D iNUG)
>>> FAQ:  http://lists.4d.com/faqnug.html
>>> Archive:  http://lists.4d.com/archives.html
>>> Options: http://lists.4d.com/mailman/options/4d_tech
>>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>>> **********************************************************************
>> 
>> 
>> 
>> 
>> --
>> ------------------------------------------------------------
>> -----------------------------
>>  Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
>>  Informed Solutions, Inc.
>>  Brookline, MA 02446 USA Registered 4D Developer
>>        Providers of 4D, Sybase & SQL Server connectivity
>>           http://www.informed-solutions.com
>> ------------------------------------------------------------
>> -----------------------------
>> This message and any attached documents contain information which may be
>> confidential, subject to privilege or exempt from disclosure under
>> applicable law.  These materials are intended only for the use of the
>> intended recipient. If you are not the intended recipient of this
>> transmission, you are hereby notified that any distribution, disclosure,
>> printing, copying, storage, modification or the taking of any action in
>> reliance upon this transmission is strictly prohibited.  Delivery of this
>> message to any person other than the intended recipient shall not
>> compromise or waive such confidentiality, privilege or exemption
>> from disclosure as to this communication.
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: http://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **********************************************************************
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to