chima
asked on
line.startsWith
Hello,
I am using if (line.startsWith("?xml", 2)) { and it is not finding ?xml within the String.
Any suggestions as to why it is not finding the substring?
I am using if (line.startsWith("?xml", 2)) { and it is not finding ?xml within the String.
Any suggestions as to why it is not finding the substring?
ASKER
mwvisa1, I considered that, and none work. Any other thoughts?
Please show me your String as that worked for me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I do not have the problem now. I think the .trim() was what was missing.
I got a question about an extra space that I am getting. If you have the time to add your comments, I would appreciate it.
I got a question about an extra space that I am getting. If you have the time to add your comments, I would appreciate it.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>Hello World!</root>
Then the ?xml starts at index 1 NOT 2.
Try this:
if (xml.startsWith("?xml", 1))