decimal to String conversion

0
Hi Experts, I need to convert 12.0 decimal to '12:0' string (. removed and replaced with :).Kindly suggest some ways
asked
3 answers
0

Maybe this will help you https://docs.mendix.com/refguide/to-string

answered
0

Hi

You can follow the below steps:

  1. Convert a variable to string using toString() method
  2. Apply String function calls to replace (.) with (:)

Please find below links if it can help:

https://docs.mendix.com/refguide/to-string

https://docs.mendix.com/refguide/string-function-calls

https://docs.mendix.com/refguide/parse-and-format-decimal-function-calls

 

answered
0

Converting to a String is locale dependent, so it can vary depending what language you are using.  Be careful when using string manipulation.

You could drop into a Java Action where you pass in a Decimal and return a String. Example code to do this and forcing the decimal separator to be ‘:’ would look like this…
 

// BEGIN USER CODE
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(':');
DecimalFormat format = new DecimalFormat("0.00", symbols);
return format.format(this.param1);
// END USER CODE


Hope this helps.

answered