Alternative simplified version of Num for this situation
C_REAL($0;$num) //same as ES_num yet support decimal
C_TEXT($1)
C_LONGINT($len;$i;$k;$j)
$num:=0
$len:=Length($1)
For ($i;$len;1;-1)
$k:=Character code($1[[$i]])
If (($k>47) & ($k<58))
$num:=$num+(($k-48)*(10^($len-$i-$j)))
Else
If
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
Hi
But Thats what I'm doing, and its not working.
The string looks like "12345.12345" and the Conversion looks like
C_REAL($Number)
C_TEXT($NumString)
$NumString:-"12345.12345"
$Number:=Num($NumString;".")
On a UK system $Number = 12345.12345
On a German system $Number = 12345
any ideas would
Much better than my choice which was substring till the period and then num
Regards
Chuck
Chuck Miller Voice: (617) 739-0306
Informed Solutions, Inc. Fax: (617) 232-1064
the second "separator" argument for Num() has existed and has been a "must use"
feature since v11 for i18n.
http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html
> 2017/12/13 8:13、Peter Mew via 4D_Tech <4d_tech@lists.4d.com> のメール:
> The imported file is always a string and the part I need is
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
If this is always a long why is the striking .XX or ,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
7 matches
Mail list logo