2008年12月30日 星期二

數值格式字串

Console.WriteLine(

string.Format("{0:#,0.00;(#,0.00);-}", -1234.56));

// (1,234.56)

Console.WriteLine(

string.Format("{0:#,0.00;(#,0.00);-}", 1234.56));

// 1,234.56

Console.WriteLine(

string.Format("{0:#,0.00;(#,0.00);-}", 0));

// -


原文

MSDN 自訂數值格式字串

2008年10月11日 星期六

Google 自定搜尋

可為自己的Blog加上Google搜尋引擎...

就如你右邊看到的那個一樣
http://www.google.com/coop/cse/

2008年10月7日 星期二

7-Zip

是一款Open Source的壓縮軟體

很可惜不能壓縮 rar 格式,但可壓成 zip 格式

*.7z 超高壓縮格式


支援格式如下..
壓縮 / 解壓縮: 7z, ZIP, GZIP, BZIP2 and TAR
只能解壓縮: RAR, CAB, ISO, ARJ, LZH, CHM, MSI, WIM, Z, CPIO, RPM, DEB and NSIS

官方網站

2008年9月28日 星期日

Vista命令行大全

Vista命令行大全

一.win+(X)

其中win不會不知道吧,X為代碼!
(1)Win+L 鎖定當前用戶.
(2)Win+E 資源管理器.
(3)Win+R 運行.
(4)Win+G (Gadgets)順序切換邊欄小工具.
(5)Win+U 輕鬆訪問中心.
(6)Win+X Windows移動中心.
(7)Win+Tab 啟用 3D窗口切換.
(8)Ctrl+Win+Tab 用鍵盤控制 Flip 3D窗口切換其中有個停頓效果.可以有足夠的時間進行選擇!
(9)Win+break 開啟系統屬性窗口.

二.Shell:command (外殼命令行)

以“Shell+冒號+命令”的格式,打開各種外殼文件夾:
(1)shell:AddNewProgramsFolder
(2)shell:Administrative Tools
(3)shell:AppData
(4)shell:AppUpdatesFolder
(5)shell:Cache
(6)shell:CD Burning
(7)shell:ChangeRemoveProgramsFolder
(8)shell:Common Administrative Tools
(9)shell:Common AppData
(10)shell:Common Desktop
(11)shell:Common Documents
(12)shell:Common Programs
(13)shell:Common Start Menu
(14)shell:Common Startup
(15)shell:Common Templates
(16)shell:CommonDownloads
(17)shell:CommonMusic
(18)shell:CommonPictures
(19)shell:CommonVideo
(20)shell:ConflictFolder
(21)shell:ConnectionsFolder
(22)shell:Contacts
(23)shell:ControlPanelFolder
(24)shell:Cookies
(25)shell:CredentialManager
(26)shell:CryptoKeys
(26)shell:CSCFolder
(27)shell:Default Gadgets
(28)shell:Desktop
(29)shell:Downloads
(30)shell:DpapiKeys
(31)shell:Favorites
(32)shell:Fonts
(33)shell:Gadgets
(34)shell:Games
(35)shell:GameTasks
(36)shell:History
(37)shell:InternetFolder
(38)shell:Links
(39)shell:Local AppData
(40)shell:LocalAppDataLow
(41)shell:LocalizedResourcesDir
(42)shell:MAPIFolder
(43)shell:My Music
(44)shell:My Pictures
(45)shell:My Video
(46)shell:MyComputerFolder
(47)shell:NetHood
(48)shell:NetworkPlacesFolder
(49)shell:OEM Links
(50)shell:Original Images
(51)shell:Personal
(52)shell:PhotoAlbums
(53)shell:Playlists
(54)shell:PrintersFolder
(55)shell:PrintHood
(56)shell:Profile
(57)shell:ProgramFiles
(58)shell:ProgramFilesCommon
(59)shell:ProgramFilesCommonX86
(60)shell:ProgramFilesX86
(61)shell:Programs
(62)shell:Public
(63)shell:PublicGameTasks
(64)shell:Quick Launch
(65)shell:Recent
(66)shell:RecycleBinFolder
(67)shell:ResourceDir
(68)shell:SampleMusic
(69)shell:SamplePictures
(70)shell:SamplePlaylists
(71)shell:SampleVideos
(72)shell:SavedGames
(73)shell:Searches
(74)shell:SendTo
(75)shell:Start Menu
(76)shell:Startup
(77)shell:SyncCenterFolder
(78)shell:SyncResultsFolder
(79)shell:SyncSetupFolder
(80)shell:System
(81)shell:SystemCertificates
(82)shell:SystemX86
(83)shell:Templates
(84)shell:TreePropertiesFolder
(85)shell:UserProfiles
(86)shell:UsersFilesFolder
(87)shell:Windows

三.快速開啟功能篇:

(1)appwiz.cpl 開啟添加刪除程序
(2)Control Pannel(控制面板)
(3)collab.cpl 網絡鄰居登陸設置
(4)desk.cpl 顯示設置
(5)firewall.cpl 防火墻設置
(6)hdwwiz.cpl 硬件添加嚮導
(7)inetcpl.cpl Internet屬性設置
(8)intl.cpl 區域和語言選項設置
(9)main.cpl 鼠標屬性設置
(10)mmsys.cpl 聲音設置
(11)ncpa.cpl 網絡連接
(12)Ncpa.cpl 開啟網絡連接
(13)powercfg.cpl 電源選項
(14)sysdm.cpl 系統屬性
(15)wscui.cpl 安全中心


四.用戶功能篇:

(1)control.exe /name Microsoft.WindowsUpdate 啟用windows update
(2)control.exe /name Microsoft.PerformanceInformationAndTools 啟用vista體驗索引窗口
(3)control.exe /name Microsoft.Personalization /page pageWallpaper 啟用壁紙設置窗口
(4)control.exe /name Microsoft.FolderOptions 啟用文件夾選項設置對話框
(5)netplwiz 打開用戶管理器

五.MMC(管理控制台)功能的快速開啟:

(1)compmgmt.msc 計算機管理控制台
(2)devmgmt.msc 設備管理器控制台
(3)diskmgmt.msc 磁盤管理器控制台
(4)eventvwr.msc 日誌管理器控制台
(5)fsmgmt.msc 共享文件夾控制台
(6)gpedit.msc 組策略管理控制台
(7)iis6.msc iis管理控制台
(8)lusrmgr.msc 本地賬戶管理控制台
(9)napclcfg.msc NAP管理控制台
(10)printmanagement.msc 打印管理控制台
(11)rsop.msc 組策略結果集控制台
(12)services.msc 服務管理控制台
(13)wf.msc 防火墻管理控制台

六.系統工具的快速啟用

(1)osk.exe 啟用屏幕鍵盤
(2)msconfig.exe 系統啟動設置工具,其中包含啟用,關閉UAC功能
(3)notepad.exe 打開記事本
(4)mspaint.exe 打開畫筆
(5)explorer.exe 啟用資源管理器
(6)cmd.exe 啟用命令行窗口
(7)SystemPropertiesAdvanced.exe“系統屬性”->“高級”
(8)SystemPropertiesComputerName.exe“系統屬性”->“計算機名”
(9)SystemPropertiesDataExecutionPrevention.exe“系統屬性”->“數據執行保護”
(10)SystemPropertiesHardware.exe“系統屬性”->“硬件”
(11)SystemPropertiesPerformance.exe“系統屬性”->“性能選項”
(12)SystemPropertiesProtection.exe “系統屬性”->“系統保護”
(13)SystemPropertiesRemote.exe “系統屬性”->“遠程”

2008年9月27日 星期六

[Vista & XP] 讓電腦開機時自動登入

開始>執行>

netplwiz

control userpasswords2

王漢宗48套自由字型 (免費中文字型)

王漢宗48套自由字型 (免費中文字型)

下載

1000種免費英文字體

1000種免費英文字體

http://www.showfont.net/

2008年9月26日 星期五

Windows XP 的乾淨開機

使用「選擇式啟動」進行 Windows XP 的乾淨開機
1
按下「開始」>「執行」。


2
在「執行」對話方塊中,輸入下列文字:
msconfig



3
按下「確定」。


4
「系統設定公用程式」出現時,按下「一般」標籤。
在「選擇式啟動」之下,確定僅勾選「載入系統服務」。
(「使用原始的 BOOT.INI」這個選項無法取消選取,這是正常的)。


5
按下「服務」標籤。


6
選取「隱藏所有 Microsoft 服務」。
警告請勿略過此行所述步驟。在繼續進行第 7 行所述步驟前,您必須隱藏 Microsoft 服務。



7
取消勾選仍顯示於「服務」標籤上的所有服務。


8
按下「套用」>「確定」。


9
當系統提示您重新啟動電腦時,按下「是」。


10
完成所有疑難排解或產品安裝。




將電腦還原為原來的設定
1
按下「開始」>「執行」。


2
在「執行」對話方塊中,輸入下列文字:
msconfig



3
按下「確定」。


4
「系統設定公用程式」出現時,請在「一般」標籤上,按下「正常啟動」。


5
按下「確定」。


6
當系統提示您重新啟動電腦時,按下「是」。




參考資料
要在 Windows XP 啟動時讓某些應用程式自動啟動,共有以下四種方法:
· 「啟動」資料夾:含有應用程式的捷徑,當 Windows 啟動後這些應用程式便會立刻執行
· Windows 登錄:含有 Windows 啟動時會跟著執行的應用程式模組
· Win.ini 檔案:含有各種裝置的 Windows 驅動程式,例如印表機和數據機等等
· System.ini 檔案:含有應用程式所需的虛擬驅動程式

選擇性啟動利用 Windows 的 MSConfig 公用程式設定下次電腦啟動時要載入哪些程式與驅動程式。在 MSConfig 對話方塊內,請根據先前的清單挑選下次電腦啟動時要執行哪些項目以及不要執行哪些項目。選擇性啟動和診斷啟動不同,前者可讓您決定 Windows 登錄資料庫與「啟動」資料夾中的哪些程式不要跟著 Windows 一起啟動,賽門鐵克建議大部分使用者都應先考慮採用選擇性啟動這種方式。

診斷啟動是一個交談式的過程,逐項詢問您要不要載入各個元件。只要選取 Windows MSConfig 公用程式中的診斷啟動,接著重新啟動電腦,或者在電腦啟動過程中早一點按住 F8 鍵,便可跳到診斷啟動模式。進行診斷啟動時,您可以針對每一個元件決定要不要載入。診斷啟動與選擇性啟動不同的地方,在於前者不能讓您針對「啟動」資料夾與 Windows 登錄資料庫中的個別項目決定要不要啟動。這種啟動方式比較適合經驗豐富的使用者,換句話說,了解各項元件對 Windows 有何影響的人比較適合採用診斷啟動方式。

http://service1.symantec.com/SUPPORT/INTER/traditionalchinesekb.nsf/twdocid/20020903092643932

開始>執行

開始>執行

開始-執行指令大全 --------------------------------------------------------------------------------
gpedit.msc-----群組原則
sndrec32-------錄音機
Nslookup-------IP位址偵測器
explorer-------開啟檔案總管
logoff---------登出指令
tsshutdn-------60秒倒計時關機指令
lusrmgr.msc----本地機用戶和組
services.msc---本機服務設定
oobe/msoobe /a----檢查XP是否啟動
notepad--------開啟記事本
cleanmgr-------磁碟垃圾整理
net start messenger----開始信使服務
compmgmt.msc---電腦管理
net stop messenger-----停止信使服務
conf-----------啟動 netmeeting
dvdplay--------DVD播放器
charmap--------啟動字元對應表
diskmgmt.msc---磁牒管理實用程序
calc-----------啟動電子計算器
dfrg.msc-------磁碟重組工具
chkdsk.exe-----Chkdsk磁牒檢查
devmgmt.msc--- 裝置管理員
drwtsn32------ 系統醫生
rononce -p ----15秒關機
dxdiag---------檢查DirectX資訊
regedt32-------註冊表編輯器
Msconfig.exe---系統配置實用程序
rsop.msc-------群組原則結果集
mem.exe--------顯示記憶體使用情況
regedit.exe----註冊表
progman--------程序管理器
winmsd---------系統資訊
perfmon.msc----電腦效能監測程序
winver---------檢查Windows版本
sfc /scannow-----掃瞄錯誤並復原
taskmgr-----工作管理器(2000/xp/-2003)
eventvwr.msc------------事件檢視器
secpol.msc----------------本機安全性設定
rsop.msc------------------原則的結果集
ntbackup----------------啟動製作備份還原嚮導
mstsc-----------遠端桌面
wmimgmt.msc----開啟windows管理體系結構WMI)
wupdmgr--------windows更新程序
wscript--------windows指令碼宿主設定
write----------寫字板
wiaacmgr-------掃瞄儀和照相機嚮導
winchat--------XP原有的區域網路聊天
mplayer2-------簡易
widnows media player mspaint--------畫圖板
mstsc----------遠端桌面連接
mplayer2-------媒體播放機
magnify--------放大鏡實用程序
mmc------------開啟控制台
mobsync--------同步指令
dfrg.msc-------磁碟重組程式
dcomcnfg-------開啟系統元件服務
ddeshare-------開啟DDE共享設定
dvdplay--------DVD播放器
ntbackup-------系統製作備份和還原
narrator-------螢幕「講述人」
ntmsmgr.msc----移動存儲管理器
ntmsoprq.msc---移動存儲管理員操作請求
netstat -an----(TC)指令檢查連接
syncapp--------新增一個公文包
sysedit--------系統配置編輯器
sigverif-------文件簽名驗證程序
shrpubw--------新增共用資料夾
secpol.msc-----本機安全原則
syskey---------系統加密,一旦加密就不能解開,保護windows xp系統的雙重密碼
Sndvol32-------音量控制程序
sfc.exe--------系統檔案檢查器
sfc /scannow---windows文件保護
tourstart------xp簡介(安裝完成後出現的漫遊xp程序)
taskmgr--------工作管理器
eventvwr-------事件檢視器
eudcedit-------造字程序
packager-------對像包裝程序
regsvr32 /u *.dll----停止dll文件執行
regsvr32 /u zipfldr.dll------取消ZIP支持
cmd.exe--------CMD命令提示字元
chkdsk.exe-----Chkdsk磁牒檢查
certmgr.msc----證書管理實用程序
calc-----------啟動計算器
cliconfg-------SQL SERVER 客戶端網路實用程序
Clipbrd--------剪貼板檢視器
netmeeting compmgmt.msc---電腦管理
ciadv.msc------索引服務程序
osk------------開啟螢幕小鍵盤
odbcad32-------ODBC資料來源管理器
iexpress-------木馬元件服務工具,系統原有的
fsmgmt.msc-----共用資料夾管理器
utilman--------協助工具管理器
Clipbrd--------剪貼板檢視器
packager-------對像包裝程序
sfc /scannow---windows文件保護 ---- 補充一下,副檔名 .cpl的也可以執行喔,自己用 dir *.cpl /s找找有哪些可以用 像 desk.cpl--桌面內容 sysdm.cpl--系統內容 --------

移除Windows XP內建的Windows Messenger (移除Windows Messenger)

「執行」視窗中輸入下面指令:
RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove

Dr.Web

開網頁連結前先掃毒...

IE:http://www.drweb.com/online/drweb-online-en.reg

FireFox:https://addons.mozilla.org/zh-TW/firefox/downloads/file/35133/dr.web_anti-virus_link_checker-1.0.18-fx+mz+tb.xpi

Opera

官網:http://www.drweb.com/?lng=en

VirusTotal 超強「36合1」免費線上掃毒

http://www.virustotal.com/zh-tw/

2008年7月29日 星期二

ASP.NET程序中常用代碼匯總

1. 打開新的窗口並傳送參數︰

//傳送參數︰
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"’)</script>")
  //接收參數︰
string a = Request.QueryString("id");
string b = Request.QueryString("id1");

2.為按鈕添加對話框

Button1.Attributes.Add("onclick","return confirm(’確認?’)");
button.attributes.add("onclick","if(confirm(’are you sure?’)){return true;}else{return false;}")

3.刪除表格選定記錄

int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex];
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString()

4.刪除表格記錄警告

private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e)
{
 switch(e.Item.ItemType)
 {
  case ListItemType.Item :
  case ListItemType.AlternatingItem :
  case ListItemType.EditItem:
   TableCell myTableCell;
   myTableCell = e.Item.Cells[14];
   LinkButton myDeleteButton ;
   myDeleteButton = (LinkButton)myTableCell.Controls[0];
   myDeleteButton.Attributes.Add("onclick","return confirm(’您是否確定要刪除這條信息’);");
   break;
  default:
   break;
 }
}

5.點擊表格行鏈接另一頁

private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
 //點擊表格打開
 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  e.Item.Attributes.Add("onclick","window.open(’Default.aspx?id=" + e.Item.Cells[0].Text + "’);");
}
  //雙擊表格連接到另一頁
  //在itemDataBind事件中
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
 string OrderItemID =e.item.cells[1].Text;
 
 e.item.Attributes.Add("ondblclick", "location.href=’../ShippedGrid.aspx?id=" + OrderItemID + "’");
}
//雙擊表格打開新一頁
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
 string OrderItemID =e.item.cells[1].Text;
 
 e.item.Attributes.Add("ondblclick", "open(’../ShippedGrid.aspx?id=" + OrderItemID + "’)");
}
  ★特別注意︰【?id=】 處不能為 【?id =】

6.表格超連接列傳遞參數

<asp:HyperLinkColumn Target="_blank" headertext="ID號" DataTextField="id" NavigateUrl="aaa.aspx?id=’
 <%# DataBinder.Eval(Container.DataItem, "數據字段1")%>’ & name=’<%# DataBinder.Eval(Container.DataItem, "數據字段2")%>’ />

7.表格點擊改變顏色

if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
 e.Item.Attributes.Add("onclick","this.style.backgroundColor=’#99cc00’;
    this.style.color=’buttontext’;this.style.cursor=’default’;");
}
  寫在DataGrid的_ItemDataBound里
if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor=’#99cc00’;
   this.style.color=’buttontext’;this.style.cursor=’default’;");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=’’;this.style.color=’’;");
}

8.關于日期格式

日期格式設定
DataFormatString="{0:yyyy-MM-dd}"
  //我覺得應該在itembound事件中
e.items.cell["你的列"].text=DateTime.Parse(e.items.cell["你的列"].text.ToString("yyyy-MM-dd"))

9.獲取錯誤信息並到指定頁面

//不要使用Response.Redirect,而應該使用Server.Transfer
  e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");

//其余的非HttpUnhandledException異常交給ASP.NET自己處理就okay了 :)
}
  //Redirect會導致post-back的產生從而丟失了錯誤信息,所以頁面導向應該直接在服務器端執行,這樣就可以在錯誤處理頁面得到出錯信息並進行相應的處理

10.清空Cookie

Cookie.Expires=[DateTime];
Response.Cookies("UserName").Expires = 0

LOCK StorageWrite reg(關閉/開啟 Usb 儲存裝置)

==========Disable

Windows Registry Editor Version 5.00



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]

"WriteProtect"=dword:00000001




===========Enable

Windows Registry Editor Version 5.00



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]

"WriteProtect"=dword:00000000

2008年7月16日 星期三

[Javascript] escape & encodeURI & encodeURIComponent

escape() will not encode: @*/+
encodeURI() will not encode: ~!@#$&*()=:/,;?+'
encodeURIComponent() will not encode: ~!*()'

http://blog.terac.com/andy/e_181.html

http://xkr.us/articles/javascript/encode-compare/

http://www.chedong.com/blog/archives/000828.html


http://www.hipaza.com/viewtopic.php?t=1306&start=0&postdays=0&postorder=asc&highlight=&sid=5abc13a79a755c58a5a73648cf9da560

[VB] OrElse 及 AndAlso 運算子

在 VB.NET 中,一般的判斷式都會使用到 Or 及 And 運算子,可是比較少人知道它們還有二個相對應的 OrElse 及 AndAlso 運算子。一般而言,筆者會建議所有的判斷式都使用 OrElse 來取代 Or 運算子,使用 AndAlso 來取代 And 運算子。為什麼呢?因為 OrElse 及 AndAlso 運算子的執行效能會優於 Or 及 And 運算子,以下就來說明其中的原由。

http://blog.blueshop.com.tw/jeff377/archive/2007/11/15/53351.aspx

日期轉換 yyyy/MM/dd → yyyyMMdd (SQL)

(case when EXPRESS_Date is null or rtrim(EXPRESS_Date) = ''

then '' else replace(Convert(Char(10),Convert(DateTime , EXPRESS_Date, 111),111),'/','') end)

2008年6月2日 星期一

TaskKill & Ntsd

taskkill /im conime.exe

===========================
PID為“444”

ntsd -c q -p 444

2008年5月26日 星期一

C# 運算子

下表根據運算子所執行的運算類型,將運算子分為幾類。每個分類都是依照優先順序列出。

主要
 x.y、f(x)、a[x]、x++、x--、new、typeof、checked、unchecked

一元 +、-、!、~、++x、--x、(T)x

算術 (乘法類) *, /, %

算術 (加法類) +, -

移位 <<, >>

關係和型別測試 <, >, <=, >=, is, as

相等 ==, !=

邏輯 (依照優先順序排列) &, ^, |

條件 (依照優先順序排列) &&, ||, ?:

設定 =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=

C# 使用字串

逸出字元

像是 "\n" (新增一行) 和 "\t" (定位鍵) 的逸出字元可包含在字串中。

程式碼行:
string hello = "Hello\nWorld!";

產出
Hello

World!

============================
如果要包含反向斜線,在反向斜線之前必須有另一個反向斜線。
下列字串:
string filePath = "\\\\My Documents\\";

產出
\\My Documents\

====================================
@ 符號

@ 符號會告訴字串建構函式忽略逸出字元和分行符號。
下列兩個字串是完全相同的:
string p1 = "\\\\My Documents\\My Files\\";
string p2 = @"\\My Documents\My Files\";

================================================
要在字串中搜尋字串,請使用 IndexOf()。如果找不到搜尋字串,IndexOf() 會傳回 -1,否則,會傳回第一個發生位置之以零起始的索引。

string s9 = "Battle of Hastings, 1066";

System.Console.WriteLine(s9.IndexOf("Hastings")); // outputs 10
System.Console.WriteLine(s9.IndexOf("1967")); // outputs -1

==================================================
將字串分隔為子字串

將字串分隔為子字串 (例如,將句子分隔為個別文字) 是常見的程式設計工作。Split() 方法使用分隔符號 (例如,空白字元) 的 char 陣列,並且傳回子字串陣列。您可以用 foreach 存取這個陣列,如下所示:

char[] delimit = new char[] { ' ' };
string s10 = "The cat sat on the mat.";
foreach (string substr in s10.Split(delimit))
{
System.Console.WriteLine(substr);
}

產出
The

cat

sat

on

the

mat.


=============================
http://msdn.microsoft.com/zh-tw/library/ms228362(VS.80).aspx

C# → Main() 傳回值

Main 方法可以屬於型別 void:

static void Main()
{
//...
}

它也可以傳回 int:

static int Main()
{
//...
return 0;
}

========MainReturnValue.cs===================================================

class MainReturnValue
{
static int Main()
{
//...
return 0;
}
}

===============text.bat=============================================

rem test.bat
@echo off
MainReturnValue
@if "%ERRORLEVEL%" == "0" goto good

:fail
echo Execution Failed
echo return value = %ERRORLEVEL%
goto end

:good
echo Execution Succeded
echo return value = %ERRORLEVEL%
goto end

:end

=====================================================

http://msdn.microsoft.com/zh-tw/library/0fwzzxz2(VS.80).aspx

2008年5月22日 星期四

M$N 去廣告

「hosts」檔案裡的最下面加入下面兩行字:

127.0.0.1 rad.msn.com
127.0.0.1 rad.live.com


Win 98/ME 的修改位置:「C:\WINDOWS」資料夾中的「hosts」檔案。


Windows 2000 : 「C:\WINNT\SYSTEM32\DRIVERS\ETC」資料夾中的「hosts」檔案。


Windows XP:「C:\WINDOWS\system32\drivers\etc」 資料夾中的「hosts」檔案。


Windows Vista:「C:\Windows\System32\drivers\etc」資料夾中的「hosts」檔案。

2008年5月21日 星期三

C# 中的進制轉換

int iNum = 253;
string strResult;

strResult = Convert.ToString(iNum, 2);
// 結果:11111101

strResult = Convert.ToString(iNum, 8);
// 結果:375

strResult = Convert.ToString(iNum, 10);
// 結果:253

strResult = Convert.ToString(iNum, 16);
// 結果:fd

C#字串輸出格式控制

C#的String.Format舉例

stringstr1 =string.Format("{0:N1}",56789); //result: 56,789.0
stringstr2 =string.Format("{0:N2}",56789); //result: 56,789.00
stringstr3 =string.Format("{0:N3}",56789); //result: 56,789.000
stringstr8 =string.Format("{0:F1}",56789); //result: 56789.0
stringstr9 =string.Format("{0:F2}",56789); //result: 56789.00
stringstr11 =(56789 / 100.0).ToString("#.##"); //result: 567.89
stringstr12 =(56789 / 100).ToString("#.##"); //result: 567

C 或 c
貨幣
Console.Write("{0:C}", 2.5); //$2.50
Console.Write("{0:C}", -2.5); //($2.50)

D 或 d
十進位數字
Console.Write("{0:D5}", 25); //00025

E 或 e
科學型
Console.Write("{0:E}", 250000); //2.500000E+005

F 或 f
固定點
Console.Write("{0:F2}", 25); //25.00
Console.Write("{0:F0}", 25); //25

G 或 g
常規
Console.Write("{0:G}", 2.5); //2.5

N 或 n
數字
Console.Write("{0:N}", 2500000); //2,500,000.00

X 或 x
十六進位
Console.Write("{0:X}", 250);

/******************************************************************************/
ASP.NET設置資料格式與String.Format使用總結(引)
{0:d} YY-MM-DD

{0:p} 百分比00.00%

{0:N2} 12.68

{0:N0} 13

{0:c2} $12.68

{0:d} 3/23/2003

{0:T} 12:00:00 AM

{0:男;;女}

DataGrid-資料格式設置運算式

資料格式設置運算式

.NET Framework 格式設置運算式,它在資料顯示在列中之前先應用於資料。此運算式由可選靜態文本和用以下格式表示的格式說明符組成:

{0:format specifier}

零 是參數索引,它指示列中要格式化的資料元素;因此,通常用零來指示第一個(且唯一的)元素。format specifier 前面有一個冒號 (:),它由一個或多個字母組成,指示如何格式化資料。可以使用的格式說明符取決於要格式化的資料類型:日期、數位或其他類型。下表顯示了不同資料類型的 格式設置運算式的示例。有關格式設置運算式的更多資訊,請參見格式化類型。

格式設置運算式


應用於此資料類型


說明


Price: {0:C}


numeric/decimal


顯示“Price:”,後跟以貨幣格式表示的數字。貨幣格式取決於通過 Page 指令或 Web.config 檔中的區域性屬性指定的區域性設置。


{0:D4}


integer(不能和小數一起使用。)


在由零填充的四個字元寬的欄位中顯示整數。


{0:N2}%


numeric


顯示精確到小數點後兩位元的數字,後跟“%”。


{0:000.0}


numeric/decimal


四捨五入到小數點後一位元的數字。不到三位元的數字用零填充。


{0:D}


date/datetime


長日期格式(“Thursday, August 06, 1996”)。日期格式取決於頁或 Web.config 檔的區域性設置。


{0:d}


date/datetime


短日期格式(“12/31/99”)。


{0:yy-MM-dd}


date/datetime


用數字的年-月-日表示的日期(96-08-06)。

唯讀

當此列處於編輯模式時,該列中的資料是否顯示在可編輯的控制項中。

2006-02-22 | asp.net資料格式的Format-- DataFormatString

我 們在呈現資料的時候,不要將未經修飾過的資料呈現給使用者。例如金額一萬元,如果我們直接顯示「10000」,可能會導致使用者看成一千或十萬,造成使用 者閱讀資料上的困擾。若我們將一萬元潤飾後輸出為「NT$10,000」,不但讓使比較好閱讀,也會讓使用者減少犯錯的機會。
下列畫面為潤飾過的結果:
上述資料除了將DataGrid Web 控制項以顏色來區隔記錄外,最主要將日期、單價以及小計這三個計欄位的資料修飾的更容易閱讀。要修飾欄位的輸出,只要設定欄位的DataFormatString 屬性即可;其使用語法如下:

DataFormatString="{0:格式字串}"

我 們知道在DataFormatString 中的 {0} 表示資料本身,而在冒號後面的格式字串代表所們希望資料顯示的格式;另外在指定的格式符號後可以指定小數所要顯示的位元數。例如原來的資料為 「12.34」,若格式設定為 {0:N1},則輸出為「12.3」。其常用的數值格式如下表所示:

格式字串 資料 結果
"{0:C}" 12345.6789 $12,345.68
"{0:C}" -12345.6789 ($12,345.68)
"{0:D}" 12345 12345
"{0:D8}" 12345 00012345
"{0:E}" 12345.6789 1234568E+004
"{0:E10}" 12345.6789 1.2345678900E+004
"{0:F}" 12345.6789 12345.68
"{0:F0}" 12345.6789 12346
"{0:G}" 12345.6789 12345.6789
"{0:G7}" 123456789 1.234568E8
"{0:N}" 12345.6789 12,345.68
"{0:N4}" 123456789 123,456,789.0000
"Total: {0:C}" 12345.6789 Total: $12345.68

其常用的日期格式如下表所示:

格式 說明 輸出格式
d 精簡日期格式 MM/dd/yyyy
D 詳細日期格式 dddd, MMMM dd, yyyy
f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm
F
完整日期時間格式
(long date + long time)
dddd, MMMM dd, yyyy HH:mm:ss
g 一般格式 (short date + short time) MM/dd/yyyy HH:mm
G 一般格式 (short date + long time) MM/dd/yyyy HH:mm:ss
m,M 月日格式 MMMM dd
s 適中日期時間格式 yyyy-MM-dd HH:mm:ss
t 精簡時間格式 HH:mm
T 詳細時間格式 HH:mm:ss

string.format格式結果

String.Format

(C) Currency: . . . . . . . . ($123.00)

(D) Decimal:. . . . . . . . . -123

(E) Scientific: . . . . . . . -1.234500E+002

(F) Fixed point:. . . . . . . -123.45

(G) General:. . . . . . . . . -123

(N) Number: . . . . . . . . . -123.00

(P) Percent:. . . . . . . . . -12,345.00 %

(R) Round-trip: . . . . . . . -123.45

(X) Hexadecimal:. . . . . . . FFFFFF85

(d) Short date: . . . . . . . 6/26/2004

(D) Long date:. . . . . . . . Saturday, June 26, 2004

(t) Short time: . . . . . . . 8:11 PM

(T) Long time:. . . . . . . . 8:11:04 PM

(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM

(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM

(g) General date/short time:. 6/26/2004 8:11 PM

(G) General date/long time: . 6/26/2004 8:11:04 PM

(M) Month:. . . . . . . . . . June 26

(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT

(s) Sortable: . . . . . . . . 2004-06-26T20:11:04

(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant)

(U) Universal sortable: . . . Sunday, June 27, 2004 3:11:04 AM

(Y) Year: . . . . . . . . . . June, 2004

(G) General:. . . . . . . . . Green

(F) Flags:. . . . . . . . . . Green (flags or integer)

(D) Decimal number: . . . . . 3

(X) Hexadecimal:. . . . . . . 00000003

說明:
String.Format
將指定的 String 中的每個格式項替換為相應物件的值的文本等效項。

例子:

int iVisit = 100;
string szName = "Jackfled";
Response.Write(String.Format("您的帳號是:{0} 。訪問了 {1} 次.", szName, iVisit));

C# 存取修飾詞

存取修飾詞是用於指定成員或型別之宣告存取範圍的關鍵字。
`

*

public
*

protected
*

internal
*

private



下列五種存取範圍層級可以使用存取修飾詞來指定:

public:存取沒有限制。

protected:存取只限於包含類別或衍生自包含類別的型別。

internal
:存取只限於目前的組件。

protected internal
:存取只限於目前的組件或衍生自包含類別的型別。

private:存取只限於包含型別(類別)。


宣告存取範圍 意義

public 存取沒有限制。

protected 存取只限於包含的類別或衍生自包含類別的型別。

internal 存取只限於目前的組件。

protected internal
存取只限於目前的組件或衍生自包含類別的型別。

private 存取只限於包含類別。



http://msdn.microsoft.com/zh-tw/library/wxh6fsc7%28VS.80%29.aspx

C# 使Function傳回多

C# 2.0

List<T>
可以依照索引存取的強型別物件清單。提供搜尋、排序和管理清單的方法。


Iterator
Iterator 是 C# 2.0 中的新功能。Iterator 是一種方法、get 存取子或運算子,它可讓您支援類別或結構中的 foreach 反覆運算,而不需要實行整個 IEnumerable 介面。相反地,您只要提供 Iterator,它會只往返於類別中的資料結構。當編譯器偵測到您的 Iterator 時,它會自動產生 IEnumerable 或 IEnumerable 介面的 Current、MoveNext 和 Dispose 方法。

Iterator 概觀
Iterator 是程式碼區段,會傳回相同型別之按順序排列的值。

Iterator 可以當做方法主體、運算子或 get 存取子使用。

Iterator 程式碼會使用 yield return 陳述式輪流傳回各元素。yield break 則會結束反覆運算。如需詳細資訊,請參閱 yield。

可在類別上實作多個 Iterator。每個 Iterator 必須像任何類別成員一樣擁有唯一名稱,且可以由 foreach 陳述式中的用戶端程式碼叫用,如下所示:foreach(int x in SampleClass.Iterator2){}。

Iterator 的傳回型別必須是 IEnumerable、IEnumerator、IEnumerable 或 IEnumerator。

yield 關鍵字可用來指定傳回的值。當到達 yield return 陳述式時,便會儲存目前的位置。此 Iterator 下一次被呼叫時,就會從這個位置重新執行。

Iterator 特別適合與集合類別搭配使用,因為能夠提供逐一查看像是二元樹等複雜資料結構的方法。

2008年5月20日 星期二

Distributed Transaction Coordinator

SQL Transaction


類別
System.Transactions



服務

需開啟 DTC

Distributed Transaction Coordinator

協調跨越多個資源管理員的交易,比如資料庫、訊息佇列及檔案系統。如果此服務被停止,這些交易將不會發生。如果服務被停用,任何明顯

依存它的服務將無法啟動。

2008年5月19日 星期一

Roadmap of Programming and Development 程式開發的學習藍圖

Roadmap of Programming and Development
程式開發的學習藍圖

作者:朱明中

http://www.microsoft.com/taiwan/msdn/columns/jhu_ming_jhong/rop.htm

BasePage

public class BasePage : System.Web.UI.Page
{
public BasePage():base()
{
}
protected override void OnPreLoad(EventArgs e)
{
base.OnPreLoad(e);
if (this.ValidatePermission() == false)
{
throw new Exception("Not Auth");
}
}
============================================================================
protected virtual bool ValidatePermission()
{
return false;
}
}


public partial class _Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
this.DataBind();
}
protected override bool ValidatePermission()
{
If( User.Name == "維克大隊長")
{
return true;
}
else
{
return false;
}
}
}

2008年5月9日 星期五

C#與VB類別共用

專案裡的App_Code,如果放.cs 和.vb的類別

在Web.config裡面加入下面語法







完整Web.config如下:

















特殊符號

㊊328A ㊋328B ㊌328C ㊍328D ㊎328E ㊏328F
㊐3290 ㊑3291 ㊒3292 ㊓3293 ㊔3294 ㊕3295 ㊖3296 ㊗3297
㊢32A2 ㊣32A3 ㊤32A4 ㊥32A5 ㊦32A6 ㊧32A7 ㊨32A8 ㊩32A9
㊫32AB ㊬32AC ㊭32AD ㊮32AE ㊯32AF
♀2640 ♁2641 ♂2642 ♃2643 ♄2644 ♅2645 ♆2646 ♇2647 ☀2600 ☁2601 ☂2602 ☃2603 ☄2604 ★2605 ☆2606 ☇2607
♈2648 ♉2649 ♊264A ♋264B ♌264C ♍264D
♎264E ♏264F ♐2650 ♑2651 ♒2652 ♓2653
♔2654 ♕2655 ♖2656 ♗2657 ♘2658 ♙2659
♠2660 ♡2661 ♢2662 ♣2663 ♤2664 ♥2665 ♦2666♧2667 ♨2668
♩2669 ♪266A ♫266B ♬266C ♭266D ♮266E♯266F
✁2701 ✂2702✃2703 ✄2704 ✆2706 ✈2708
✉2709 ✐2710 ✑2711✒2712 ✓2713 ✔2714 ✕2715 ✖2716
✗2717✘2718 ✙2719 ✠2720 ✡2721 ✢2722 ✣2723✤2724
✥2725 ✦2726 ✧2727 ✩2729 ✰2730✱2731 ✲2732 ✳2733☈2608 ☉2609 ☊260A ☋260B ☌260C ☍260D ☎260E ☏260F
☑2611 ☒2612 ☓2613
☚261A ☛261B ☜261C ☝261D ☞261E ☟261F
☠2620 ☡2621 ☢2622 ☣2623 ☤2624 ☥2625 ☦2626 ☧2627
☨2628 ☩2629 ☪262A ☫262B ☬262C ☭262D ☮252E ☯262F
☰2630 ☱2631☲2632 ☳2633☴2634 ☵2635 ☶2636☷2637
✴2734 ✵2735 ✶2736✷2737 ✸2738 ✹2739 ✿273F
❀2740 ❁2741 ❂2742❃2743 ❄2744 ❅2745 ❆2746 ❇2747
☸2638 ☹2639 ☺263A ☻263B ☼263C ☽263D ☾263E ☿263F
❡2761❢2762 ❣2763 ❤2764 ❥2765 ❦2766 ❧2767
ⓐ24D0 ⓑ24D1 ⓒ24D2 ⓓ24D3 ⓔ24D4 ⓕ24D5 ⓖ24D6
ⓗ24D7 ⓘ24D8 ⓙ24D9 ⓚ24DA ⓛ24DB ⓜ24DC ⓝ24DD
ⓞ24DE ⓟ24DF ⓠ24E0 ⓡ24E1 ⓡ24E2 ⓣ24E3 ⓤ24E4
❈2748❉2749 ❊274A ❋274B
❍274D ❏274F ❐2750 ❑2751 ❒2752

清除IE記錄資訊

# 清除 IE7 temporary Internet files 紀錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

# 清除 IE7 cookies 紀錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

# 清除 IE7 瀏覽紀錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

# 清除 IE7 表單資料
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

# 清除 IE7 已記憶的表單ID與密碼記錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

# 清除 IE7 全部的記錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

# 清除 IE7 附加元件所產生的資訊記錄
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

2008年4月10日 星期四

C# Active Directory

在Microsoft .NET Framework 中,ADSI是獨立在一個命名空間 System.DirectoryService,預設是沒被加入參考
它提供二個類別 一個是DirectoryEntry,另一個是 DirectorySearcher , 二個適用範圍不同
DirectoryEntry用來存取物件資料
DirectorySearcher 負責AD的搜尋


如果你要用System.DirectoryService存取AD,要準備三件事

一、將System.DirectoryService.dll加入參考
二、準備好可登入網域 且有可存取指定資源權限的使用考帳號碼含名稱跟密碼
三、 將想要查詢的物件階層,組合成LDAP查詢字串 (LDAP查詢字串是存取Active Directory物件的核心,每一個在AD中的物件,
都會有一個固定的唯一名稱,這個名稱叫做Distinguished Names(DN), DirectoryEntry會依LDAP所給的DN來搜尋AD,若LDAP指示的DN
找不到資料,就會傳回伺服器中無此物件的訊息。

LDAP 查詢字串的結構為

LDAP://[distinguished name]
LDAP://cn=[common name], ou=[Organization Unit Name], dc =[Doma

例如,要查詢 Acme.com的DC中的Administrator使用者時,若只有單一層的Domain 那LDAP的字串會簡單多

LDAP://cn=Administrator,cn=Users, dc=acme,dc=com

如何用AD做使用者驗證?

首先 先要由表單取得使用者輸入的名稱與密碼

並把它綁到DirectoryEntry物 件中

若要在驗證時進一步取到使用者的資訊 像uid或 sid


那可和DirectorySearcher 做整合然後啟動搜尋

若找不到使用者的物件 則可傳回錯誤

可用SearchResult.GetDirectoryEntry()來取得使用者的AD物件



DirectorySearcher searcher = new DirectorySearcher ( new DirectoryEntry("LDAP://dc=jcistudio.idv.tw",userName,password)); //設定符合使用者名稱的使用者



searcher.Filler = "(&&objectClass=User)(sAMAccountName=" + userName + "))"; //搜尋使用者

SearchResult result = searcher.Findone();
if( result == null)
Response.Write("User is not exist.") ; //錯誤訊息

2008年4月9日 星期三

XCOPY AutoBackUp

XCOPY 來源資料夾 目的資料夾 /S /D /Y

/S 複製每個目錄及其包含的子目錄。
/D 複製發生變更的檔案。
/Y 所有覆蓋的詢問都回答 YES

EX:
XCOPY "C:\MyDoc" "E:\BackUpFolder" /S /D /Y

=============================================
註解 = rem
EX:
rem Start BackUp Function...

============================================
設定變數 = set
EX:
set A=B

變數 A 的值是 B

使用變數 %變數%
EX:
%A%
============================================

@echo off
cls
echo Start Test Function...
rem 宣告一個變數A等於EE
set A=EE
rem 顯示變數A
echo %A%


rem 宣告一個變數B等於今天日期
set B=%date%
rem 顯示變數B
echo %B%

set year=%date:~0,4%
echo %year%

echo 1234567890
echo ABCDEFGHIJ

set s=ABCDEFGHIJ
echo %s:~0,2%

echo %s:~0,2%
echo %s:~4,4%
echo %s:~4,-4%
echo %s:~,-4%
echo %s:~,-4%
echo %s:~-4%

pause
cls

2008年4月7日 星期一

C#.net常用函數和方法集匯總

C#.net常用函數和方法集匯總


1、DateTime 數位型
System.DateTime currentTime=new System.DateTime();
1.1 取當前年月日時分秒
currentTime=System.DateTime.Now;
1.2 取當前年
int 年=currentTime.Year;
1.3 取當前月
int 月=currentTime.Month;
1.4 取當前日
int 日=currentTime.Day;
1.5 取當前時
int 時=currentTime.Hour;
1.6 取當前分
int 分=currentTime.Minute;
1.7 取當前秒
int 秒=currentTime.Second;
1.8 取當前毫秒
int 毫秒=currentTime.Millisecond;
(變數可用中文)

1.9 取中文日期顯示——年月日時分
string strY=currentTime.ToString("f"); //不顯示秒

1.10 取中文日期顯示_年月
string strYM=currentTime.ToString("y");

1.11 取中文日期顯示_月日
string strMD=currentTime.ToString("m");

1.12 取中文年月日
string strYMD=currentTime.ToString("D");

1.13 取當前時分,格式為:14:24
string strT=currentTime.ToString("t");

1.14 取當前時間,格式為:2003-09-23T14:46:48
string strT=currentTime.ToString("s");

1.15 取當前時間,格式為:2003-09-23 14:48:30Z
string strT=currentTime.ToString("u");

1.16 取當前時間,格式為:2003-09-23 14:48
string strT=currentTime.ToString("g");

1.17 取當前時間,格式為:Tue, 23 Sep 2003 14:52:40 GMT
string strT=currentTime.ToString("r");

1.18獲得當前時間 n 天後的日期時間
DateTime newDay = DateTime.Now.AddDays(100);

2、Int32.Parse(變數) Int32.Parse("常量")
字元型轉換 轉為32位數位型

3、 變數.ToString()
字元型轉換 轉為字元串
12345.ToString("n"); //產生 12,345.00
12345.ToString("C"); //產生 ¥12,345.00
12345.ToString("e"); //產生 1.234500e+004
12345.ToString("f4"); //產生 12345.0000
12345.ToString("x"); //產生 3039 (16進制)
12345.ToString("p"); //產生 1,234,500.00%


4、變數.Length 數位型
取字串長度:
如: string str="中國";
int Len = str.Length ; //Len是自訂變數, str是求測的字串的變數名

5、System.Text.Encoding.Default.GetBytes(變數)
字碼轉換 轉為比特碼
如:byte[] bytStr = System.Text.Encoding.Default.GetBytes(str);
然後可得到比特長度:
len = bytStr.Length;

6、System.Text.StringBuilder("")
字元串相加,(+號是不是也一樣?)
如:System.Text.StringBuilder sb = new System.Text.StringBuilder("");
sb.Append("中華");
sb.Append("人民");
sb.Append("共和國");

7、變數.Substring(參數1,參數2);
截取字串的一部分,參數1為左起始位數,參數2為截取幾位。
如:string s1 = str.Substring(0,2);

8、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
取遠端用戶IP位址

9、穿過代理伺服器取遠端用戶真實IP位址:
if(Request.ServerVariables["HTTP_VIA"]!=null){
string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}else{
string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
}

10、 Session["變數"];
存取Session值;
如,賦值: Session["username"]="小布什";

取值: Object objName=Session["username"];
String strName=objName.ToString();
清空: Session.RemoveAll();

11、String str=Request.QueryString["變數"];
用超連接傳送變數。
如在任一頁中建超連接:點擊
在Edit.aspx頁中取值:String str=Request.QueryString["fdid"];

12、DOC對像.CreateElement("新增節點名");
新增XML我的文件新節點

13、父節點.AppendChild(子節點);
將新增的子節點加到XML我的文件父節點下

14、 父節點.RemoveChild(節點);
移除節點

15、Response
Response.Write("字串");
Response.Write(變數);
向頁面輸出。

Response.Redirect("URL位址");
跳轉到URL指定的頁面

16、char.IsWhiteSpce(字串變數,位數)——邏輯型
查指定位置是否空字元;
如:
string str="中國 人民";
Response.Write(char.IsWhiteSpace(str,2)); //結果為:True, 第一個字元是0位,2是第三個字元。

17、char.IsPunctuation('字元') --邏輯型
查字元是否是標點符號
如:Response.Write(char.IsPunctuation('A')); //返回:False

18、(int)'字元'
把字元轉為數位,查程式碼點,注意是單引號。
如:
Response.Write((int)'中'); //結果為中字的程式碼:20013

19、(char)程式碼
把數位轉為字元,查程式碼代表的字元。
如:
Response.Write((char)22269); //返回「國」字。

20、 Trim()
清除字串前後空格

21 、字串變數.Replace("子字串","取代為")
字串取代
如:
string str="中國";
str=str.Replace("國","央"); //將國字換為央字
Response.Write(str); //輸出結果為「中央」

再如:(這個非常實用)

string str="這是

Search My Blog

分類

Click Me

Chat

雜記

亂七八糟的記憶

funP

Blog Tree