CBool Function
๋ฌธ์์ด ๋น๊ต ๋๋ ์ซ์ ๋น๊ต๋ฅผ ๋ถ๋ฆฌ์ธ ์์ผ๋ก ๋ณํํ๊ฑฐ๋ ๋จ์ผ ์ซ์ ์์ ๋ถ๋ฆฌ์ธ ์์ผ๋ก ๋ณํํฉ๋๋ค.
๊ตฌ๋ฌธ:
CBool (Expression1 {= | <> | < | > | <= | >=} Expression2) ๋๋ CBool (Number)
๋ฐํ ๊ฐ:
Bool
๋งค๊ฐ ๋ณ์:
Expression1, Expression2: ๋น๊ตํ ์์์ ๋ฌธ์์ด ๋๋ ์ซ์ ์์ ๋๋ค. CBool ํจ์๋ ์์ด ์ผ์นํ ๊ฒฝ์ฐ True๋ฅผ, ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ False๋ฅผ ๊ตฌํฉ๋๋ค.
Number: ๋ณํํ ์์์ ์ซ์ ์์ ๋๋ค. ์์ด 0์ผ ๊ฒฝ์ฐ False๊ฐ, ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ True๊ฐ ๊ตฌํด์ง๋๋ค.
๋ค์์ CBool ํจ์๋ฅผ ์ฌ์ฉํ์ฌ Instr ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํ๋ ๊ฐ์ ํ๊ฐํ๋ ์์ ๋๋ค. ์ด ํจ์๋ ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ๋ฌธ์ฅ์ "and"๋ผ๋ ๋จ์ด๊ฐ ์กด์ฌํ๋์ง ์ฌ๋ถ๋ฅผ ๊ฒ์ฌํฉ๋๋ค.
์:
Sub ExampleCBool
Dim sText As String
sText = InputBox("Please enter a short sentence:")
REM Proof(ยปandยซ๊ฐ ๋ฌธ์ฅ์ ๋ํ๋๋ ๊ฒฝ์ฐ)
REM Instead of the command line
REM If Instr(Input, "and")<>0 Then...
REM the CBool function is applied as follows:
If CBool(Instr(sText, "and")) Then
MsgBox "The word ยปandยซ appears in the sentence you entered!"
EndIf
End Sub