EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

STR compare in picbasic

Started by comalco2000 November 25, 2002
I have a string in a variable array

ie STR mydata(0) = "Hello"

I would like to compare it to a list of around 60 other strings to
see if they match. Both Case and blanks are sensitive!

ie STR storeddata(0) = "Random Text"
" "
" "
" "
" "
STR storeddata(60) = "More Data Here too"

Whats the quickest and simplest way to compare a string variable to
others??

Could I do (say) ......

Search:
For n = 1 to 60
If STR mydata(0)= STR storeddata(n) then goto Match
next n
NoMatch:
etc etc
Match:
etc etc



If PICBasic allows inline assembly, you could use this:
http://www.piclist.com/techref/piclist/codegen/keyword_interpreter.htm

---
James Newton, webhost piclist.com (former Admin #3)
j...@piclist.com 1-619-652-0593 fax:1-208-279-8767
PIC/PICList FAQ: http://www.piclist.com or .org

-----Original Message-----
From: comalco2000 [mailto:c...@yahoo.com.au]
Sent: Sunday, November 24, 2002 10:51 PM
To: p...@yahoogroups.com
Subject: [piclist] STR compare in picbasic

I have a string in a variable array

ie STR mydata(0) = "Hello"

I would like to compare it to a list of around 60 other strings to
see if they match.  Both Case and blanks are sensitive!

ie STR storeddata(0) = "Random Text"
   " "
   " "
   " "
   " "
   STR storeddata(60) = "More Data Here too"

Whats the quickest and simplest way to compare a string variable to
others??

Could I do (say) ......

Search:
  For n = 1 to 60
    If STR mydata(0)= STR storeddata(n) then goto Match
  next n
NoMatch:
  etc etc 
Match:
  etc etc 


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

">Yahoo! Terms of Service.

The 2024 Embedded Online Conference