IBM Lotus Symphony
|
يتم تحويل مقارنة مجموعة حروف أو مقارنة رقمية لتعبير Boolean expression، أو تحويل تعبير رقمي واحد لتعبير Boolean expression.
CBool (Expression1 {= | <> | < | > | <= | >=} Expression2) or CBool (Number)
Bool
Expression1, Expression2: أي تعبيرات رقمية أو تعبيرات من مجموعة حروف تريد مقارنتها. اذا كانت التعبيرات متطابقة، ستقوم وظيفة CBool function بارجاع True، خلاف ذلك سيتم ارجاع False.
رقم: أي تعبير رقمي تريد تحويله. اذا كان التعبير يساوي 0، سيتم ارجاع False، خلاف ذلك سيتم ارجاع True.
يستخدم المثال التالي وظيفة CBool لتقييم القيمة التي يتم ارجاعها بواسطة وظيفة Instr function. تقوم الوظيفة بالتحقق مما اذا كانت كلمة "and" تم ايجادها في الجملة التي تم ادخالها بواسطة المستخدم.
Sub ExampleCBool
Dim sText As String
sText = InputBox("Please enter a short sentence:")
REM Proof if the word »and« appears in the sentence.
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