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 ($k=46)  //decimal
$num:=$num*(10^-($len-$i-$j))
$len:=$i
$j:=1  //$j+1
Else 
$len:=$len-1
End if 
End if 
End for 
If ($k=45)
$num:=$num*-1
End if 
$0:=$num

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>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 be very welcome
>Im considering using replace string on $numString to replace "." with the
>local separator, in this case ","
>
>thanks
>-pm
>
>On Wed, Dec 13, 2017 at 2:32 AM, Chuck Miller via 4D_Tech <
>4d_tech@lists.4d.com> wrote:
>
>> 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
>>  mailto:cjmiller<AT SIGN>informed-solutions.com
>>  Brookline, MA 02446 USA Registered 4D Developer
>>        Providers of 4D and Sybase 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.
>>
>> > On Dec 12, 2017, at 7:22 PM, Keisuke Miyako via 4D_Tech <
>> 4d_tech@lists.4d.com> wrote:
>> >
>> > 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 <
>> http://doc.4d.com/4Dv16/4D/16.3/Num.301-3651255.en.html>
>>
>> **********************************************************************
>> 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
>**********************************************************************

**********************************************************************
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