examine string


Closed Thread
Results 1 to 5 of 5

Thread: examine string

  1. #1
    Join Date
    Mar 2008
    Posts
    43

    Default examine string

    I don't see any way to work with strings in PBP.
    I have strings such as "11000011", I need to look at each position and if it is a 1 do something
    and if it is a zero do something else. Also, what is PBPL? I would like to use Long data type but it's only available in PBPL.

    Thanks,
    Bob Hiller

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I don't see any way to work with strings in PBP.
    I have strings such as "11000011", I need to look at each position and if it is a 1 do something
    and if it is a zero do something else. Also, what is PBPL?

    The following simple snippet will solve your problem.


    Code:
    My_Byte = "11000011"
    
    For B0 = 0 to 7
    
    If My_Byte0.[B0] = 1 then DO SOMETHING
    Else
    DO SOMETHING ELSE
    endif
    
    Next B0

    Cheers

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    PBPL allows you to use LONG type variables, 32 bit numbers. LONGS can only be used with 18Fxxx chips and was a new feature with PBP 2.50.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    I can't get this to work, I fixed what I thought where some typo's but not sure how to define this, it doesn't like the quotation marks.

    Quote Originally Posted by aratti View Post
    The following simple snippet will solve your problem.


    Code:
    My_Byte = "11000011"
    
    For B0 = 0 to 7
    
    If My_Byte0.[B0] = 1 then DO SOMETHING
    Else
    DO SOMETHING ELSE
    endif
    
    Next B0

    Cheers

    Al.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    My_Byte = %11000011
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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