RyanHan
Junior Member level 3
Dear All,
I had a DataString buffer of ASCII code read from the serial port and wanted to check and process the code if it match certain pattern. My pointer x = 0 is a CR so I check the charater before CR to match certain patterns. Is there a way to shorten the code so its more readable that will also yeild a true if the string character matches? Thanks a lot
I had a DataString buffer of ASCII code read from the serial port and wanted to check and process the code if it match certain pattern. My pointer x = 0 is a CR so I check the charater before CR to match certain patterns. Is there a way to shorten the code so its more readable that will also yeild a true if the string character matches? Thanks a lot
Code:
if ((DataString0[x-7]=='T') && (DataString0[x-6]=='1') &&
(DataString0[x-5]=='V') && (DataString0[x-4]=='a') &&
(DataString0[x-3]=='l') && (DataString0[x-2]=='i') && (DataString0[x-1]=='d'))
{
.
.
.
}