Question Token Ibragimov · Apr 2, 2018

How to set space in numbers

Hello!

Is it possible in cache to divide numbers with spaces. For example number 12500 divide to 12 500?

Thank you!

Comments

Dmitry Maslennikov · Apr 2, 2018
set groupSeparator=##class(%SYS.NLS.Format).SetFormatItem("NumericGroupSeparator"," ")
write $fnumber(12345.678, ",", 2)
12 345.68

By default in english locale group separator is comma

0
Rasha Ahamed  Apr 5, 2018 to Dmitry Maslennikov

Thanks Dmitry it was helpful to me as well.

0
Eduard Lebedyuk  Apr 5, 2018 to Diones Forteski

$translate would be better here

write $translate("12 500", " ")

To remove everything except numbers use $zstrip:

write $zstrip("12 500", "*E'N")
0
Diones Forteski · Apr 5, 2018

Hi,

No, you will have to find a way to remove the spaces, for example:

USER>Set ValueA = 12500

USER>Set ValueB = "12 500"

USER>Write ValueA/($Replace(ValueB," ",""))
1

0