📜  js 检查等值线的字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:14.890000             🧑  作者: Mango

代码示例1
// Check if a string is an isogram
function isIsogram(str){
   return !str.match(/([a-z]).*\1/i);
  //or: return new Set(str.toLowerCase()).size === str.length;
}
console.log(isIsogram("Dermatoglyphics"));//, true
console.log(isIsogram("isogram"));          //, true
console.log(isIsogram("moOse"));          //, false
console.log(isIsogram("isIsogram"));      //, false
console.log(isIsogram(""));                  //, true