简体   繁体   English

格式化从脏数据存储中获取的值

[英]Formatting values fetched from dirty datastore

Is it possible to format data which is fetched from dirty? 是否可以格式化从脏文件中获取的数据? For example, 83647 to be formatted as 83,647. 例如,将83647格式化为83,647。 I have the following code for unformatted data: 我有以下代码用于未格式化的数据:

db.on('load', function() {
  db.set('john', {completed: '83647'});
  console.log('John's completed tasks are: %s', db.get('john').completed);
});

Numeral.js is what you are looking for.. Numeral.js是您正在寻找的..

example: 例:

numeral(12345).format('0,0'); // -> 12,345

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 格式化使用来自 SharePoint 的 REST ajax 调用获取的日期 - Formatting a date fetched using REST ajax call from SharePoint 解析本地数据存储区:管理脏的固定对象 - Parse Local Datastore: manage dirty pinned objects 如何从脏形式的 object 中获取值并将其放入数组中? - How to get values from object of dirty form and put into Array instead? 禁用组合框,直到获取数据库中的值 - To disable combo box until values from database has been fetched 如何将值插入到从 firebase firestore 获取的下拉选择中? - How to insert values into dropdown select, fetched from firebase firestore? 以反应钩子形式设置从 api 获取的值 - Set values fetched from api in react hooks form 如何分配使用JavaScript从数组中获取的动态值 - How to assign dynamic values fetched from an array using javascript 无法映射到从 mongodb 获取的数组中的对象值 - Not able to map to values of the object inside an array fetched from mongodb Javascript JQuery:从获取的列表中排除某些值 - Javascript JQuery: Exclude certain values from fetched list 打印数组中的所有值,但如果有间隔,则使用格式 - Print all values from array but with formatting if there are intervals
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM