2011-07-01から1ヶ月間の記事一覧

VBScript の関数、Minute

まんま MsgBox Minute(Now)

VBScript の関数、Mid

MsgBox Mid("abc", 1) ' abc MsgBox Mid("abc", 2) ' bc MsgBox Mid("abc", 4) ' MsgBox Mid("abc", 1, 1) ' a

VBScript の関数、LTrim, RTrim, Trim

MsgBox Len(LTrim(" abc ")) MsgBox Len(RTrim(" abc ")) MsgBox Len(Trim(" abc ")) MsgBox Len(Trim(Chr(9) & "abc" & Chr(9))) タブにはきかない???

VBScript の関数、Log

MsgBox Log(1) MsgBox Log(2.718282)

VBScript の関数、LoadPicture

Set p = LoadPicture("c:\foo.jpg") MsgBox p.Width MsgBox p.Height

VBScript の関数、Len

MsgBox Len("abc") ' 3 MsgBox Len(123) ' 3

VBScript の関数、Left

MsgBox Left("ABC", 1) ' A MsgBox Left("ABC", 0) ' MsgBox Left("ABC", 2) ' AB MsgBox Left("ABC", 4) ' ABC

VBScript の関数、LCase

MsgBox LCase("ABC") MsgBox LCase("abc") MsgBox LCase("Abc123") MsgBox LCase("ABC")

VBScript の関数、LBound

Dim array1(3) Dim array2(3,4) MsgBox LBound(array1) MsgBox LBound(array2, 1) MsgBox LBound(array2, 2)

VBScript の関数、Join

Dim array(3) array(0) = "foo" array(1) = "bar" array(2) = "baz" MsgBox Join(array) MsgBox Join(array, ", ") Perl とかでイメージするのとは違って、終端にも delimiter が付くようだ

VBScript の関数、IsObject

ほぼ、まんま Set MyObject = Me MsgBox IsObject(MyObject) ' True MsgBox IsObject(1) ' False Me って何?

VBScript の関数、IsNumeric

MsgBox IsNumeric(1) ' True MsgBox IsNumeric(-1) ' True MsgBox IsNumeric(1.2) ' True MsgBox IsNumeric("1e1") ' True MsgBox IsNumeric("1,000,000") ' True MsgBox IsNumeric("1,000,00") ' True MsgBox IsNumeric("123") ' True MsgBox IsNumeric(…

VBScript の関数、IsNull

MsgBox IsNull(x) ' False Dim x MsgBox IsNull(x) ' False x = 1 MsgBox IsNull(x) ' False x = Null MsgBox IsNull(x) ' True x = Empty MsgBox IsNull(x) ' False

VBScript の関数、IsEmpty

MsgBox IsEmpty(x) ' True Dim x MsgBox IsEmpty(x) ' True x = 1 MsgBox IsEmpty(x) ' False x = Null MsgBox IsEmpty(x) ' False x = Empty MsgBox IsEmpty(x) ' True

VBScript の関数、IsDate

MsgBox IsDate("October 19, 1962") ' True MsgBox IsDate(#10/19/62#) ' True MsgBox IsDate("foo") ' False MsgBox IsDate("November 30, 1962") ' True MsgBox IsDate("November 31, 1962") ' False 関係ないけど、複文?は「:」でつなげるんだね〜

VBScript の関数、IsArray

Dim array(3) array(0) = 1 MsgBox IsArray(array) ' True MsgBox IsArray(x) ' False MsgBox IsArray(1) ' False

VBScript の関数、InStrRev

MsgBox InStrRev("abcabc", "ab") ' 4 MsgBox InStrRev("abcabc", "ab", 2) ' 1 MsgBox InStrRev("abcabc", "ab", 1) ' 0 MsgBox InStrRev("abcabc", "cd") ' 0

VBScript の関数、InStr

MsgBox InStr("abcde", "ab") ' 1 MsgBox InStr("abcde", "cd") ' 3 MsgBox InStr("abcde", "CD") ' 0 MsgBox InStr(2, "abcde", "ab") ' 0 日本語の扱い不明

VBScript の関数、InputBox

MsgBox InputBox("Hi!") MsgBox InputBox("Hi!" & Chr(13) & "Hey!") MsgBox InputBox("Hi!", "Title") MsgBox InputBox("Hi!", "Title", "Default") MsgBox InputBox("Hi!", "Title", "", 10, 100) 最後の引数、ヘルプまわりは深く追求せず

VBScript の関数、Hour

MsgBox Hour(Now) MsgBox Hour(#4:45:23 PM#) ' 16

VBScript の関数、Hex

MsgBox Hex(1) ' 1 MsgBox Hex(10) ' A MsgBox Hex(16) ' 10 MsgBox Hex(16.4) ' 10 MsgBox Hex(16.5) ' 10 MsgBox Hex(-1) ' FFFF MsgBox Hex(-16.4) ' FFFFFFF0 MsgBox Hex(-16.5) ' FFFFFFF0 MsgBox Hex(&HF) ' F

VBScript の関数、GetRef

まんま <SCRIPT LANGUAGE="VBScript"> Function GetRefTest() Dim Splash Splash = "GetRefTest Version 1.0" & vbCrLf Splash = Splash & Chr(169) & " YourCompany 1999 " MsgBox Splash End Function Set Window.Onload = GetRef("GetRefTest") </SCRIPT>

VBScript の関数、GetObject

MsgBox GetObject("C:\foo.jpg") ' [object]

VBScript の関数、GetLocale

MsgBox GetLocale ' 1041

VBScript の関数、FormatPercent

MsgBox FormatPercent(1) ' 100.00% MsgBox FormatPercent(1, 4) ' 100.0000% MsgBox FormatPercent(0.0001, 2, TristateTrue) ' .01%

VBScript の関数、FormatNumber

MsgBox FormatNumber(1.23456789) ' 1.23 MsgBox FormatNumber(1.23456789, 2) ' 1.23 MsgBox FormatNumber(1.23456789, 3) ' 1.235 MsgBox FormatNumber(1.23456789, 4) ' 1.2346 MsgBox FormatNumber(0.1, 2, TristateFalse) ' .10 MsgBox FormatNumber(10…

VBScript の関数、FormatDateTime

MsgBox FormatDateTime("2011-07-05") ' 2011/07/05 MsgBox FormatDateTime("2011-07-05", vbGeneralDate) ' 2011/07/05 MsgBox FormatDateTime("2011-07-05", vbLongDate) ' 2011年7月5日 MsgBox FormatDateTime("2011-07-05", vbShortDate) ' 2011/07/05 M…

VBScript の関数、FormatCurrency

MsgBox FormatCurrency(1000) ' \1,000 MsgBox FormatCurrency(-1000, -1, -1, -1, 0) ' (\1000)

VBScript の関数、Int、Fix

MsgBox Int(1.2) ' 1 MsgBox Int(1.5) ' 1 MsgBox Fix(1.2) ' 1 MsgBox Fix(1.5) ' 1 MsgBox Int(-1.2) ' -2 MsgBox Int(-1.5) ' -2 MsgBox Fix(-1.2) ' -1 MsgBox Fix(-1.5) ' -1 MsgBox Int("1.2")

VBScript の関数、Filter

Dim StrArray(6) StrArray(0) = "Sunday" StrArray(1) = "Monday" StrArray(2) = "Tuesday" StrArray(3) = "Wednesday" StrArray(4) = "Thursday" StrArray(5) = "aWed" x = Filter(StrArray, "Mon") MsgBox x(0) x = Filter(StrArray, "T") MsgBox x(0) & "…