Solved

Format number to string with no commas or decimals

  • 5 November 2022
  • 2 replies
  • 797 views

Userlevel 1
Badge +4

Hello. I want to convert 4 or more digit numbers to strings that don't have any punctuation. 

 

For example, when I format the number 4444 to a string and choose "Number" as the format. The resulting string is "4,444.0". I want the result to be "4444".

 

How can I achieve that? Thank you.

 

 

icon

Best answer by WouterT 5 November 2022, 13:06

View original

2 replies

Userlevel 3
Badge +9

Here is a two-step solution hopefully:


1. Convert the numeric value into an integer


2. Create a text string with the integer in it.


 


Here is the little test:



One start variable: a numeric input with the value 4321.56



followed by:



I added the '<' and the '>' just for clarity in the output here.



Gives the result :


Userlevel 1
Badge +4

Thank you, @WouterT 


The 2 step process worked. 


 


It didn't occur to me to use the operation "Create a text string". I was originally using the action "Format number to string" and it added the comma thousands separator as well as the ".0" at the end.


 


I also tried skipping the "Convert a value" step, which converts the number to an integer. And that produced a string without the thousands separator, but the ".0" was still displayed.


 


So, the 2 step process is the winner. Thank you!

Reply