View Full Version : examine string
PlantBob
- 18th January 2011, 15:59
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
aratti
- 18th January 2011, 17:22
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.
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.
mackrackit
- 18th January 2011, 18:36
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.
PlantBob
- 18th January 2011, 18:39
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.
The following simple snippet will solve your problem.
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.
mackrackit
- 19th January 2011, 02:18
My_Byte = %11000011
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.