1 / 10

ASP 基礎- VBScript 常用函數

ASP 基礎- VBScript 常用函數. 張森. CStr : 轉換為字串 CStr(10)+CStr(20)  1020 CInt : 轉換為整數 A= “ 10 ” CInt(A)+20  30 其他型別轉換函數 CBool, CByte, CCur, CDate, CDbl, CLng, CSng. Int : 取小於或等於某數的最大整數 Int(25.7)  25 Int(-33.6)  -34 Fix : 去掉小數部分 Fix(25.7)  25 Fix(-33.6)  -33. InStr : 尋找字串

tab
Download Presentation

ASP 基礎- VBScript 常用函數

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP基礎-VBScript常用函數 張森

  2. CStr : 轉換為字串 • CStr(10)+CStr(20)  1020 • CInt : 轉換為整數 • A=“10” CInt(A)+20  30 • 其他型別轉換函數 • CBool, CByte, CCur, CDate, CDbl, CLng, CSng

  3. Int : 取小於或等於某數的最大整數 • Int(25.7)  25 • Int(-33.6)  -34 • Fix : 去掉小數部分 • Fix(25.7)  25 • Fix(-33.6)  -33

  4. InStr : 尋找字串 • X=“This is a book.” A=InStr(X, “is”)  3 (從X第1個字元起找出“is”出現的位置) A=InStr(4, X, “is”)  6 (從X第4個字元起找出“is”出現的位置)

  5. Join : 將字串陣列組合成一個字串 • Dim A(2) A(0)=“I” A(1)=“am” A(2)=“God.” Join(A)  “I am God.” Join(A, “,”)  “I,am,God.”

  6. Split : 將字串分割成字串陣列 • X=“男 女” Y=“男, 女” A=Split(X)  A(0)=“男”A(1)=“女” B=Split(Y, “, ”)  B(0)=“男”B(1)=“女”

  7. Len : 計算字串長度 • Len(“Windows Me 中文版”)  14 (中文、空白皆算一個字元) • Left, Right : 傳回左/右邊的字元 • A=“Windows Me 中文版” Left(A,3)  “Win” Right(A,3)  “中文版”

  8. Mid : 取中間字元 • A=“Windows Me 中文版” Mid(A,9)  “Me 中文版” Mid(A,9,2)  “Me” • LTrim, RTrim, Trim : 去掉空白字元 • A=“ ASP ” LTrim(A)  “ASP ” RTrim(A)  “ ASP” Trim(A)  “ASP”

  9. Replace : 取代字串 • A=“Windows Me 中文版” Replace(A, “Me”, “98”)  “Windows 98 中文版” • UCase, LCase : 轉換為大/小寫 • A=“Windows Me 中文版” UCase(A)  “WINDOWS ME 中文版” LCase(A)  “windows me 中文版”

  10. Date, Time, Now : 系統的日期,時間 • Year, Month, Day : 取出年,月,日 • Year(Date), Month(Date), Day(Date) • Hour, Minute, Second : 取出時,分,秒 • Hour(Time), Minute(Time), Second(Time)

More Related