export function patchZero(origin,num) {
    let originSize = String(origin)
    for(var i = 0;i<num-originSize.length;i++){
      origin = "0"+String(origin)
    }
    return origin
}

export function sliceStr(str,num=100) {
    if(str.length>num){
      str = str.substr(0,num) +"...";
    }
    return str;
}

export function getRandomString(length = 8) {
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  let result = '';
  for (let i = 0; i < length; i++) {
    result += chars.charAt(Math.floor(Math.random() * chars.length));
  }
  return result;
}
