You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemmionic5/Mohem/src/app/hmg-common/services/guid/guid.service.ts

26 lines
465 B
TypeScript

import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class GuidService {
constructor() { }
public generate(): string {
let result = '';
let i: string;
for ( let j = 0; j < 32; j++) {
if (j == 8 || j == 12 || j == 16 || j == 20)
{
result = result + '-';
}
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
return result;
}
}