PicBasic Forums | microEngineering Labs | Online Compilers
How to join the PicBasic List | Search the PicBasic Forums | Privacy Policy


 

PicBasic List Archive

Topics Last Day Last Week New Messages Keyword Search

String Comparison

Technical Forum: PicBasic List 05/2000 to 07/2001: String Comparison

 
By Anonymous on Tuesday, October 3, 2000 - 07:24 am:

With all the exchange about string conversions, this is a good time to ask
this one...

Is there a reasonable way to do string comparisons?

Suppose we define a variable as a string array of 10 characters, say Sample
var Byte[10], and do a SERIN2 into the Sample array. Is there a practical
way to then do a case analysis or equivalent like...

If Sample = "yes" then ...
If Sample = "no" then...
If Sample = "maybe" then...

I can write a subroutine to loop and compare each character for a match, but
I'm wondering if anyone has found a shortcut. Can this be combined with a
Lookup / Lookdown approach?

Harold

PIC BASIC Mailing List
Crownhill Associates Ltd
www.crownhill.co.uk
www.picbasic.co.uk

To remove yourself from this list, please send email to
majordomo@qunos.net
with this text in its body: unsubscribe picbasic-l

By Anonymous on Tuesday, October 3, 2000 - 09:32 am:

There are no shortcuts. If you want to be absolutely shure,
compare both arrays, element by element.
If a rough comparison is OK for you, you may count the
Control Sum during receiving/transmitting and compare
it with Control Sum of original array. I use it when I send
a long message (variable length) to Vaccuum Fluorescent
Display with serial interface. PIC in VFD controller receives
message byte by byte, immediately transmits them to VFD
and counts the Control Sum of all long message. When all
message is received and displayd, PIC sends back to the
main PC the Control Sum (CS). Main PC compares received
CS with transmitted CS, and repeats the transmission, if
received CS differs from transmitted CS.
If have any questions - I am still in Norcross, GA.
Call: 770-452-0005 ext. 298 (9:30am-1:30pm Mon-Fri),
770-754-6667 - other times and days.
agrant@iq-corp.com
Allan Grant

P.S. Do you have any results with CAN and PICs. I have the
same CAN Kit and have no time to try it.

PIC BASIC Mailing List
Crownhill Associates Ltd
www.crownhill.co.uk
www.picbasic.co.uk

To remove yourself from this list, please send email to
majordomo@qunos.net
with this text in its body: unsubscribe picbasic-l


Topics Last Day Last Week New Messages Keyword Search Administration