Qt - custom decimal point and thousand separator

后端 未结 6 1834
野趣味
野趣味 2021-02-13 23:52

How can I convert a number (double) to string, with custom decimal point and thousand separator chars?

I\'ve seen QLocale, but I don\'t want to choose the localization c

6条回答
  •  不知归路
    2021-02-14 00:28

    for qml users:

    function thousandSeparator(input){
        return input.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
    }
    

提交回复
热议问题