Commit 526bb79a by fukai

支持空白行校验

parent b9cb4054
# 1.0.0
`2016.07.23`
- 提供登入功能
- 提供主页框架与简单展示
\ No newline at end of file
...@@ -261,14 +261,20 @@ function TestAdr(adr,reg,line,length) ...@@ -261,14 +261,20 @@ function TestAdr(adr,reg,line,length)
let a1 = [] let a1 = []
let a2 = [] let a2 = []
let a3 = []
for(let i=0;i<arr.length;i++) for(let i=0;i<arr.length;i++)
{ {
if(arr[i].length > length) if(arr[i].length > length)
a1.push(i+1) a1.push(i+1)
if(arr[i].length <= length && !new RegExp(`^${reg}$`).test(arr[i])) else if(arr[i].length == 0 || /^\s+$/.test(arr[i]))
{
a3.push(i+1)
}
else if(arr[i].length <= length && !new RegExp(`^${reg}$`).test(arr[i]))
a2.push(i+1) a2.push(i+1)
} }
let linemsg = '' let linemsg = ''
if(arr.length > line) if(arr.length > line)
...@@ -280,6 +286,8 @@ function TestAdr(adr,reg,line,length) ...@@ -280,6 +286,8 @@ function TestAdr(adr,reg,line,length)
} }
if(a2.length) if(a2.length)
msg.push(`第${a2.join(',')}行格式非法`) msg.push(`第${a2.join(',')}行格式非法`)
if(a3.length)
msg.push(`第${a3.join(',')}行格式空白行`)
if(linemsg) if(linemsg)
msg.push(linemsg) msg.push(linemsg)
return msg.join(';') return msg.join(';')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment