close
http://bioankeyang.blogspot.com/2014/04/jsjavascript.html
import { Pipe, PipeTransform } from '@angular/core';
// export enum PipeParm {
// CompileStatus = 'CompileStatus',
// CompilePGType = 'CompilePGType',
// YN2Boolean = 'YN2Boolean'
// }
@Pipe({ name: 'thousand' })
export class ThousandPipe implements PipeTransform {
bol: Boolean;
transform(number): any {
let num = number.toString();
const pattern = /(-?\d+)(\d{3})/;
while (pattern.test(num)) {
num = num.replace(pattern, '$1,$2');
}
return num;
}
}
全站熱搜
留言列表