Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在NativeScript中格式化数字?_Nativescript_Google Sheets Formula - Fatal编程技术网

如何在NativeScript中格式化数字?

如何在NativeScript中格式化数字?,nativescript,google-sheets-formula,Nativescript,Google Sheets Formula,我有很多Google Sheets的代码,现在我开始在NativeScript中使用它。我知道如何在谷歌表单中设置数字格式,但我在组件中找不到任何类似的选项 例如,我的函数返回百分比值,它是介于0和1之间的数字。在GoogleSheets中,我编写code=myFunction(),然后为单元格选择合适的格式,它看起来像23.5% 在NativeScript中,我使用XML文件并编写 <Label text=“{{ myFunction }}”/> 但是它显示了0.235876

我有很多Google Sheets的代码,现在我开始在NativeScript中使用它。我知道如何在谷歌表单中设置数字格式,但我在组件中找不到任何类似的选项

例如,我的函数返回百分比值,它是介于0和1之间的数字。在GoogleSheets中,我编写code=myFunction(),然后为单元格选择合适的格式,它看起来像23.5%

在NativeScript中,我使用XML文件并编写

<Label text=“{{ myFunction }}”/>

但是它显示了0.2358765,我在NativeScript文档中找不到任何选项来正确格式化这个数字


我不熟悉CSS,可能我必须使用CSS吗?我必须使用哪个CSS或NativeScript命令来格式化数字?

您应该能够执行以下操作:

这些链接将为您提供更多详细信息和一些不同的选择:

如果希望经常重复使用数据模型或应用程序模块,则应在数据模型或应用程序模块中声明

在转换器中写入的内容完全取决于数字的格式。甚至还有支持解释Excel公式的NPM软件包,您可能也要检查它们。

(myVariable)。NativeScript不支持ToLocalString('en-us',{minimumFractionDigits:2})-但感谢我检查它们的链接。