Receiving serial data as string and comparing them with other strings

So, I think I will just cross my fingers and pray that it will work. After all, that'ss what programmers do

Not good ones. Good ones address the underlying issue and write bullet-proof code. You, on the other hand, sound like a future Microsoft employee.