For my Job I am currently working with the programming language PROGRESS. To format numbers etc. we are using the simple STRING() function. Now the following problem appeared while developing:
If I have a number like 13 and print it using STRING(13, "Z99")
I get " 13"
but if I print it using STRING(13, ">99")
I still get " 13".
The problem is the blank space. From the Progress documentation it should be possible to erase the blank spaces =>Progress Documentation
As it is defined in the Progress documentation "Z" replaces not available digits with a blank but ">" suppresses the output of the missing digit.
Currently the best solution we have is to use TRIM() around the STRING() function. But as more code goes by I can't stop thinking that this should be possible without the TRIM function.
Or am I misunderstanding the progress documentation?
Thank you guys in advance.
Version: Open Edge 12.2.8
Z
and >
change the behavior of any leading non-format symbol. See:
message quoter( string( 13, '$>>9' ) ).
message quoter( string( 13, '$ZZ9' ) ).
Which will produce output:
" $13"
"$ 13"
Neither of which helps you. The formats are suited for producing fixed width font tabular output.
If you do not need any formatting at all, which is unlikely as soon as your numbers are more than three or so digits, you can use string without a format:
message quoter( string( 13 ) ).
Which produces:
"13"
The quoter
function has been used in all the above examples to highlight where the spaces are.