tyatech-format
v1.0.1
Published
Tya Technologies
Downloads
36
Readme
Tyatech Angular - Format Library
Vietnamese number format (Định dạng số Việt Nam)
import { TyaDirectivesModule } from 'tyatech-format';
...
@NgModule({
declarations: [...],
imports: [
...,
TyaDirectivesModule,
...
],
exports: [...]
})
<input TyaFormatNumberVn />
Limit Display Word
import { limitDisplayWord } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(limitDisplayWord({ value: "string of words", limit: 4 }));
//stri...
}
}
Format Number Vietnam
import { formatNumberVietnam } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(formatNumberVietnam('1111.52'));
//1.111,52
}
}
Remove Vietnamese Accents
import { removeVietnameseAccents } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(removeVietnameseAccents('chuỗi từ tiếng Việt'));
//chuoi tu tieng Viet
}
}
Remove Punctuation
import { removePunctuation } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(removePunctuation('text: content'));
//textcontent
}
}
The list will be deleted: space . , : ; - + ? ! * & % # $ / \ { } [ ]
Remove Text in String
import { removeText } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(removeText('data123'));
//123
}
}
Remove Number in String
import { removeNumber } from 'tyatech-format';
...
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
console.log(removeNumber('data123'));
//data
}
}