C 常用的一些簡單的操作方法

2021-06-01 18:45:19 字數 1786 閱讀 8169

/// /// 過濾字串方法,用於將單引號等特殊符號轉化成中文符號

///

/// 要轉化的字串

public static string filterstr(string msg)

public static void message(string meg)

public static string filterstrhtml(string msg)

public static string filterstrnocode(string msg)

//彈出訊息框

/// /// 訊息提示框

///

/// 訊息內容

public static void showmsgbox(string msg)

/// /// 彈出訊息框,呼叫彈出訊息框,不影響樣式buss.showmessage(this.page,"提交成功");

///

/// page對像

/// 訊息

public static void showmessage(system.web.ui.page page, string msg)

/// /// 擷取字串

///

/// 原字串

/// 要擷取的長度

///

public static string returnstr(string msg, int lenth)

return result;

}/// ///

///

///

///

/// /// 剪下指定長度的字串,並去掉html標記

///

/// 要剪下字串的object形式

/// 長度(中文長度為2)

///

public static string cutstringx(object strr, int len)

if (ch == '>')

if (ncutlen == 0 && ch.tostring() == " " && ch.tostring() == "\n")

if (bleft == 0)

else

strret += ch;}}

strret = strret.replace(" ", " ");

if (npos < nlen)

return strret;

}//是否為中文

public static bool ischinese(char ch)

//html標記轉換

public static string htmlencode(string str)

/// /// 把日期時間轉換為日期,去掉時間

///

/// 格式:yyyy-mm-dd hh:mm:ss

/// 返回日期 yyyy-mm-dd

public static string getdate(string str)

//隨機函式產生字元

public static string createrandomcode(int codecount, string allchar)

int t = rand.next(allchararray.length);

if (temp == t && brecreate)

temp = t;

randomcode += allchararray[t];

}return randomcode;

}

相關的一些操作方法

create table tb user id int,name varchar 30 gender char 3 birthday datetime,salary double 7,2 插入資料 insert into 表名 列名,列名.列名 values 值1,值2.值n insert into...

MySql Docker的一些操作方法

偶爾有需求,涉及到資料庫的改動,那一定要表結構改動 程式除錯都先在測試環境淬鍊千百遍。現在流行微服務 docker部署,很容易拉起一整套環境。mysql image mysql 5.7.25 restart unless stopped command default authentication ...

mysql的一些操作方法小結

輸入 mysql uroot p 緊接著會出現 password 輸入設定的密碼即可。注意 p後無 如加上會出現錯誤。輸入 exit show databases 操作成功 query ok 操作失敗 error use 資料庫名 操作成功 database changed show tables ...