check.cs
来自「这是一个图书馆管理用的简化系统」· CS 代码 · 共 119 行
CS
119 行
using System;
using System.Collections.Generic;
using System.Text;
namespace BMS
{
class Check
{
public static bool index(int[] m, int k)
{
if (m != null)
{
for (int i = 0; i < m.Length; i++)
{
if (m[i] == k)
{
return true;
}
}
}
return false;
}
public static bool abc123(System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar >= '!' && e.KeyChar <= '}')
{
if ("1234567890_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".IndexOf(e.KeyChar) < 0)
{
return false;
}
return true;
}
return true;
}
public static bool num(System.Windows.Forms.TextBox tb,System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar >= '!' && e.KeyChar <= '}')
{
if ("1234567890".IndexOf(e.KeyChar) < 0)
{
if (e.KeyChar == '.' && tb.Text.IndexOf(".") < 0)
{
return true;
}
return false;
}
}
return true;
}
public static bool Integer(System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar >= '!' && e.KeyChar <= '}')
{
if ("1234567890".IndexOf(e.KeyChar) < 0)
{
return false;
}
return true;
}
return true;
}
public static bool safe(System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar >= '!' && e.KeyChar <= '}')
{
if ("'<=>".IndexOf(e.KeyChar) >= 0)
{
return false;
}
return true;
}
return true;
}
public static bool Email(System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar >= '!' && e.KeyChar <= '}')
{
if ("1234567890._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@".IndexOf(e.KeyChar) < 0)
{
return false;
}
return true;
}
return true;
}
public static bool Email(string str)
{
if (str.Trim() == "")
{
return false;
}
int local;
string str1;
local = str.IndexOf("@");
if (local > 0 && (str.Substring(local+1)).IndexOf("@")<0)
{
if (str.IndexOf(".") > local)
{
local = str.IndexOf(".");
str1 = str.Substring(local+1);
local = str1.IndexOf(".");
if(local>=0 && str1.Substring(0,local)=="")
{
return false;
}
if((local<0||str1.LastIndexOf(".")==local)&&str.LastIndexOf(".")<str.Length-1)
{
return true;
}
}
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?