Search
answer = s.substring(s.indexOf("Start:"), s.indexOf("\""));
in place of
answer = s.substring(s.indexOf("Start:"), s.indexOf("""));
\
can be used to escape quotations or apostrophe.
質問
How to use a character like this " in a context like this.
String s;
answer = s.substring(s.indexOf("Start:"), s.indexOf("""));
When I use a word like ("stop"); or something (if the word stop is in the string!) it works perfect. But I want you read from ("Start:"), till the character ".
How can I set the character in the indexOf?
解決
Search
answer = s.substring(s.indexOf("Start:"), s.indexOf("\""));
in place of
answer = s.substring(s.indexOf("Start:"), s.indexOf("""));
\
can be used to escape quotations or apostrophe.
他のヒント
Use \
to escape the double quote.
For instance:
s.indexOf("\"");
try this \
for escaping double quote
s.indexOf("\"");