/**
 * 字符串转二进制
 * */
export function strToBinary(str) {
  let result = [];
  let list = str.split('');
  for (let i = 0; i < list.length; i++) {
    if (i !== 0) {
      result.push('_');
    }
    let item = list[i];
    let binaryStr = item.charCodeAt()
      .toString(2);
    result.push(binaryStr);
  }
  let resultStr = result.join('');
  resultStr = resultStr.replaceAll('0', '-').replaceAll('1', '.');
  return resultStr;
}
