Not able to convert String to Integer when receiving data from pubnub?
This is the code which worked for me:-

        msg.remove(0,1); msg.remove(msg.length());
        pos = msg.toInt();
        Serial.print("value of servo angle: "); Serial.println(pos);
        myservo.write(pos);


I had to remove this character (" ") by using msg.remove(0,1) &amp; msg.remove(msg.length()) that removes starting and ending string.