I have a sketch that reads a onewire memory into a 40 byte array "data" that consists of alphanumeric data all together. Now i need to compare parts of that result to known strings for my program and i've hiut a wall on how to do it more elegantly... The parts that i need to compare are of fixed position and width. for example, this is the content of the array, printing from 0 to 40 inside a for loop: MAST00AC065195033CN0P975F4789096BJ174A02 i want to compare parts of it in order and do program stuff, like the MAST00 then 065 then 195 etc etc
i'd rather not have to load a variable with each letter and compare part to part ina for loop as it's tedious and takes a ton of ram and sketch space. how can i compare part of the array to a string? like data[0-3] == "MAST" ?
i've ben looking at string manipulation routines and somehow i'm not very convinced, for example, indexOf returns the index, so i'd need to then check if the position returned is consistent.
Or i should convert the character array to a string(or simply inputting it in a string in the first place -i need to check if the library allows this- and then using substring() paired with comparison to my reference?