首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

判断四个字符串比较是否有重复的快捷算法

2012-11-07 
判断4个字符串比较是否有重复的快捷算法/** * 检查4个墙面名称,不能相同 */function checkWallName(){var

判断4个字符串比较是否有重复的快捷算法
/**
* 检查4个墙面名称,不能相同
*/
function checkWallName()
{
var repeat = new Array();
repeat.push(wallName1.getValue());
repeat.push(wallName2.getValue());
repeat.push(wallName3.getValue());
repeat.push(wallName4.getValue());
return isRepeat(repeat);
}

function   isRepeat(a)
{
        return   /(\x0f[^\x0f]+)\x0f[\s\S]*\1/.test( "\x0f "+   a.join( "\x0f\x0f ")   + "\x0f ");
}

热点排行