How to Add Extra Space in Between the Current and Decimal Value When Using Currency

Share with Love

One way to achieve the expected format of “INR 123” is to use a custom format mask with a space between the currency symbol and the value.

To do this, you can follow these steps:

Open the section where the currency control is located.
Select the currency control, and go to the Presentation tab in the Properties panel.
Under the Format Mask section, select Custom.
In the Custom Format field, enter the desired format mask, which in this case would be “¤ #,##0.00” (note the space between the currency symbol and the number format).
Save and test the section.
This should display the currency value in the format of “INR 123” instead of “INR123”.

 

OR

 

In Pega, you can add extra space between the current and decimal value when using currency by modifying the currency format settings in the harness or section rule. Here are the steps to follow:

  1. Open the harness or section rule where you want to display the currency values.
  2. Find the currency field that you want to format and click on the gear icon to open the field properties.
  3. In the “Presentation” tab, click on the “Edit format” button next to the “Currency format” field.
  4. In the “Currency format” dialog box, modify the format string by adding a space character between the current and decimal value placeholders.
  5. For example, if the current format string is “$#,##0.00”, you can modify it to “$#,##0. 00” (note the extra space character after the “0”).
  6. Click “Save” to apply the new format string and close the dialog box.
  7. Save and close the harness or section rule.

After following these steps, the currency field will display with an extra space between the current and decimal value when the harness or section rule is rendered in the user interface.

 

OR

Change the dropdown Currency symbol (e.g. $) to 3 character currency code (e.g. USD)

 

Or We can use JS

var str = “INR856″;
var match = str.match(/\d+/);

var newStr = insertBeforeLastOccurrence(str, match[0], ” “);

console.log(newStr);

function insertBeforeLastOccurrence(strToSearch, strToFind, strToInsert) {
var n = strToSearch.lastIndexOf(strToFind);
if (n < 0) return strToSearch;
return strToSearch.substring(0,n) + strToInsert + strToSearch.substring(n);
}