英文:
Change negative number format in Bi-Publisher RTF
问题
我正在进行一个 RTF,希望你能帮助我,如何更改负数的格式?
将“-”更改为“()”
例如,我有:
821,292.87
-146,983.06
-671.64
503,927.51
我希望以以下方式看到它们:
821,292.87
(146,983.06)
(671.64)
503,927.51
英文:
I am doing an RTF I hope you can help me, how could I change the negative number format?
Change "-" for "()"
For example I have:
821,292.87
-146,983.06
-671.64
503,927.51
And I would like to see them in the following way:
821,292.87
(146,983.06)
(671.64)
503,927.51
答案1
得分: 1
你可以使用 PR
格式模型来在尖括号内获取负数:
SQL> select to_char(-146983.06,'999g999g999d99PR','NLS_NUMERIC_CHARACTERS = ''.,''') l
from dual;
L
----------------
<146,983.06>
或者你也可以使用 regexp_replace
和 to_char
来实现:
regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''),
'-(.*)','()' )
示例:
SQL> select regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''),
'-(.*)','()' ) l
from dual;
L
------------------------------
(146983.06)
英文:
You can use PR
format model to get negative numbers in angle brackets:
SQL> select to_char(-146983.06,'999g999g999d99PR','NLS_NUMERIC_CHARACTERS = ''.,''') l
from dual;
L
----------------
<146,983.06>
Or I would do this with regexp_replace
and to_char
:
regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''),
'-(.*)','(\1)' )
Example:
SQL> select regexp_replace( to_char(-146983.06,'tm9','NLS_NUMERIC_CHARACTERS = ''.,'''),
'-(.*)','(\1)' ) l
from dual;
L
------------------------------
(146983.06)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论