⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 publicapplication.cs

📁 网络考试系统 系统基于 .NET 框架开发
💻 CS
字号:
using System;

using System.Text;
using System.Text.RegularExpressions;

namespace ExamSystem
{
	/// <summary>
	/// PublicApplication 的摘要说明。
	/// </summary>
	public class PublicApplication
	{
		public PublicApplication(){}


		/// <summary>
		/// 处理字符串
		/// </summary>
		/// <param name="str"></param>
		/// <param name="sign"></param>
		/// <param name="area"></param>
		/// <returns></returns>
		public static string GetFormatStr(string str,string sign,string area){
			if(str != null && str != ""){
				int sIndex = str.IndexOf(sign);
				if(area == "start"){
					return str.Substring(0,sIndex);
				}else if(area == "end"){
					return str.Substring(sIndex+sign.Length,str.Length-sIndex-sign.Length);
				}else{
					return "";
				}
			}
			return "";
		}


		/// <summary>
		/// 检查是否是数字
		/// </summary>
		/// <param name="str"></param>
		/// <returns></returns>
		public static bool IsNumeric(string input){

			string pat=@"^(?:[1-9]\d{1,6}|\d{0,7}(\.\d{1,2})?|0\.0[1-9]|0\.[1-9]\d)$";
			Regex r = new Regex(pat,RegexOptions.Compiled);
			Match m=r.Match(input);

			if(m.Success){
				return true;
			}

			return false;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -