SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple boolean expressions in an \"If\" statement.

    How do you put an "And" in an If statement?
    I am reading lines from a file and I need to extract a value based on the first 2 characters of a String.

    The 1st character is a number, the Second cannot be blank. (IPAddress)

    I have something like this
    STRING sLine
    if isDigit(Left(sLine, 1)) AND Left(sLine, 2) != " "

    What's the best way to verify both conditions are true?

    ------------------

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Multiple boolean expressions in an \"If\" statement.

    Greg,
    Specifically, in your situation, you want to write the following code:

    The IsDigit function only evaluates the first character of the string, so the second argument you had in there isn't needed (will cause a compiler error, actually). SubStr will be needed to get just the second character as the way you used Left will return the first two characters of the string.

    - Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Multiple boolean expressions in an \"If\" statement.

    Logical and && Returns TRUE if both operands evaluate to TRUE; returns FALSE if either operand is FALSE.
    Logical or | | Returns TRUE if either operand evaluates to TRUE; returns FALSE if both operands are FALSE.
    Logical not ! Takes only one operand. If the operand evaluates to TRUE, ! makes the resulting value FALSE. If the operand evaluates to FALSE, ! makes the resulting value TRUE.

    ------------------

  4. #4
    Junior Member
    Join Date
    Aug 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Multiple boolean expressions in an \"If\" statement.

    Thanks Guys!

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:09 AM.

Copyright BetaSoft Inc.