The IPAddress
class has a member function bool fromString(const char *address)
.
const char *apipch = "192.168.4.1";
IPAddress apip;
if(apip.fromString(apipch)){ // try to parse into the IPAddress
Serial.println(apip); // print the parsed IPAddress
} else {
Serial.println("UnParsable IP");
}