Grouping of Numbers | WordPress.org

Hello @mishrackant

Thank you very much for using our plugin. You can use the toLocaleString method.

For example, assuming you have the equation fieldname1+fieldname2, and you want to return the result in Indian system, you can edit it as follows:

(fieldname1+fieldname2).toLocaleString('hi-IN')

Now, How to transform a value in Indian system to a valid javascript number to use in mathematical operations?

For example, assuming the fieldname1 is in Indian System, and you want to use it in a mathematical operation, like fieldname1*3

You can implement the equation as follows:

(function(){
var field = parseFloat((fieldname1|r).replace(/[^\d\.]/g, ''));

return field*3;
})()

Note the use of the |r modifier with the field’s name. The plugin extracts numbers from fields values before evaluating the equations to use them in mathematical operations. But in your case, the default extraction of the plugin is not a solution. You need to get the field’s raw value to process it yourself. The |r modifier gives you access the field’s raw value, without preprocessing.

If you want to the previous equation returns the value in Indian System, you can edit it as follows:

(function(){
var field = parseFloat((fieldname1|r).replace(/[^\d\.]/g, ''));

return (field*3).toLocaleString('hi-IN');
})()

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer