08-21-2007 10:23 AM
Hi Experts,
My question is : Do we have any function which can correctly format an string which is storing an amount.
For example:
Input String : '1234567'
Expected outpt : '1.234.456,00'
Input String : '1.23456.78,2586'
Expected outpt : '12.345.678,26'
Requirement is like :
there should be exectly 3 digits between consecutive '.' ','
if there are more then 2 digits after decimal point , the number should be rounded off.
08-21-2007 12:02 PM
You can use CONVERT_STRING_TO_INTEGER
But the entry doesn't have to have any comma or point.
For your case you can:
1- Split string between integer and decimal part.
2. Delete all point from integer part
3. Convert to integer
4. Check if third char of decimal part is greater than 5. If it is add 1 to second char.
5. Concatenate integer from step three, a comma and first two chars from step 4.
If u don't know how program any step post here.
Regards and remember reward all helpfull answes.
manel
08-21-2007 12:39 PM
Hmmm that's correct. we can do that, that way. but i did not want to hard code
the decimal point to ","
otherwise application wont work as expected, if the same application is used in
American context ( as in US, people use "." as decimal point) .
Is there any way to find out the context , in which the application is being used ?
Thanks and Regards
Shiv