Skip to Content
author's profile photo Former Member
Former Member

decimal to comma and vice-versa

Hi,

I want to change the comma in the number format to decimal (for decimals' place) and also the thousands' separator should be a comma.

For eg: 3.267,3 should be converted to 3,267.3

Can i use a standard function(which one?, how?) or a user-defined java function(if so, plz give the code)?

Please help.

Thanks,

John

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on May 22, 2009 at 09:50 AM

    >

    > Hi,

    >

    > I want to change the comma in the number format to decimal (for decimals' place) and also the thousands' separator should be a comma.

    >

    > For eg: 3.267,3 should be converted to 3,267.3

    >

    > Can i use a standard function(which one?, how?) or a user-defined java function(if so, plz give the code)?

    >

    > Please help.

    >

    > Thanks,

    > John

    a.replaceAll(".","~");
    a.replaceAll(",","@");
    a.replaceAll("~",",");
    a.replaceAll("@",".");
    return a;

    😊 a simple approach ...

    you can also play around with indexOf and do the exact conversion

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2009 at 09:56 AM

    Hi,

    It can be simply done with a standard function replaceString

    replaceString(Source, Constant(","), Constant("$"))

    replaceString(Source, Constant("."), Constant(","))

    replaceString(Source, Constant("$"), Constant("."))

    for help refer to

    http://help.sap.com/saphelp_nw04/helpdata/en/4c/b2ad3de2d76b3be10000000a114084/frameset.htm

    Regards,

    chandra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 22, 2009 at 10:01 AM

    Hi,

    You can use replaceString function from Text category.

    Mapping:

    InputValue(3.267,3) -->
    Constant(.) -->             replaceString -->             
    Constant(-) -->                                               replaceString -->
                                       Constant(,) -->                                        replaceString --> OutPut
                                       Constant(.) -->                      Constant(-) -->
                                                                            Constant(,) -->

    -Rohit

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.