Apex- no viable alternative at character ' ' while substring

524 Views Asked by At

I am trying to get substring fom a string. I have a xml response and I want to get only few tags and there values to parse. but I am getting error :- no viable alternative at character ' '

 responseObj.xmlResponse = response.getBody();
            String xmlbody =response.getBody();


   order OrderID=new order();
                String substr=xmlbody.substring(xmlbody.indexOf("<OrderID>"));
1

There are 1 best solutions below

0
On

Try this.

String substr=xmlbody.substring(xmlbody.indexOf('<OrderID>'));