How to detect leading double-quote in a string in Java?
<p>I'm writing a tokenizer that reads code from a file and am having difficulty with the - seemingly - trivial task of getting it to branch into the case that handles string constants (any token that starts and ends with a double quote).</p>

<p>The conditional I wrote for the branch is </p>

<p><code>if (token.charAt(0) == '"') { // Do some stuff }</code></p>

<p>where <code>token</code> is the string that was read in.</p>

<p>Alternatively, I've also tried</p>

<p><code>if (token.startsWith("\"")) { // Do some stuff }</code></p>

<p>I've checked the debugger and it still refuses to enter the branch even for valid cases such as the string <code>"Paris"</code> with value field <code>[”, P, a, r, i, s, ”]</code></p>

<p>Any suggestions would be appreciated.</p>
