# EVALUATE'ing decimal strings

Hi All! I need to transform some decimal string as 00000123459500 knowing that there are 4 decimal positions to the right, I’ve actually did it using an EVALUATE expression:

``````EVALUATE(decVariable, COPYSTRING(dec_string, 1, 10) + ',' + COPYSTRING(dec_string,11,4));
``````

But I feel that it’s a wrong approach as it depends on regional settings (as in spain ‘,’ is the decimal delimiter). Anyone knows a better way to do it, that is ‘regional settings’-proof ? Thanks in advance… Aitor.PS: I almost found a workaround

``````EVALUATE(decVariable, COPYSTRING(dec_string, 1, 10) + COPYSTRING(FORMAT(1.1),2,1) + COPYSTRING(dec_string,11,4));
``````

Edited by - azto on 2001 Aug 29 15:43:57

why don’t you simply devide the code into two steps like: EVALUATE(DecimalValue, StringValue); DecimalValue := DecimalValue / 10000; okay, that’s not very elegant, but it should do its purpose… Stefan Weinreich Billing Analyst Edited by - StefanWeinreich on 2001 Aug 29 16:19:38

quote:

Originally posted by StefanWeinreich: why don’t you simply devide the code into two steps like: EVALUATE(DecimalValue, StringValue); DecimalValue := DecimalValue / 10000; okay, that’s not very elegant, but it should do its purpose… St

Hi Stefan! As the number of decimals is variable i would need to divide by

``````POWER(10,NumDecimals)
``````

, but it’s ok! I won’t change the way it works now (mainly because it’s already working) but it’s a straightforward approach!

quote:

Originally posted by StefanWeinreich: EVALUATE(DecimalValue, StringValue); DecimalValue := DecimalValue / 10000; okay, that’s not very elegant, but it should do its purpose…

Not elegant? This is very elegant!! ------- With best regards from Switzerland Marcus Fabian