CheckData字元類方法 字串操作 6

2021-04-13 02:48:25 字數 1121 閱讀 4104

#region     // fields

private static regex regdecimal;

private static regex regchzn;

private static regex regdecimalsign;

private static regex regemail;

private static regex regnumber;

private static regex regnumbersign;

#endregion       

#region     // methods

///

/// 建構函式

///

public checkdata()

static checkdata()

///

/// 如果格式正確則返回空,否則返回錯誤資訊適用於 2006/06/13 格式

///

/// 待測試的日期字串

///

public static string checkdate(string sour)

///

/// 如果格式正確則返回空,否則返回錯誤資訊

///

/// 待測試的日期字串

/// 是否必須大於今天

/// 是否不可以為空值

///

public static string checkdate(string sour, bool isuptoday, bool isnotnull)

}else if (sour == "")

if (isuptoday && (sour.compareto(datetime.now.tostring(@"yyyy//mm//dd")) < 0))

if (!regdate(sour))

return "";

}///

/// 如果格式正確則返回空,否則返回錯誤資訊

///

/// 待測試的日期字串

/// 是否必須大於今天

///

public static string checkdate(string sour, bool isuptoday)

CheckData字元類方法 字串操作 1

類擬substring一樣eg getcountstring abcde 1,3 返回bcd public string getcountstring string lzpstr,int startindex,int length if length bytes.length startindex ...

CheckData字元類方法 字串操作 4

檢查字串最大長度,返回指定長度的串 public static string sqltext string sqlinput,int maxlength return sqlinput 檢查從頁面輸入的字串,防止sql注入攻擊 public static string checkstring str...

php 類 方法關鍵字

1 final 如果我們不希望乙個類被繼承,我們使用final來修飾這個類。這個類將無法被繼承。final 用於類 方法前。final類 不可被繼承。final方法 不可被覆蓋。2 public 表示全域性,類內部外部子類都可以訪問 private表示私有的,只有本類內部可以使用 protected...