Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to format a string which is representing an amount

Former Member
0 Kudos

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.

2 REPLIES 2

former_member582701
Contributor
0 Kudos

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

0 Kudos

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