check string for specific characters?
Have you tried the following?

if(!actualString.startsWith(expectedString)) {
  // do whatever you have to
}


BTW, that is what actually suggested in @EdgarBonet's comment.