How do i parse a 3 value delimited file String|String|IPAddress?


I have a text file that acts as a config file for a ping monitor (the pinguino) that i have put together.

I am not sure how to read this text file to ping the appropriate devices without putting the values into the code.

Here is the format of my text file, it is very simple right now:

1|Google DNS1|



I am only interested in everything other than the pipes.

How can i read this in, given that the first to values are strings, and the last one is object IPAddress?

Also, i want this to be completely dictated by the text file, so how can i repeately declare the IPAddress to be used in a "check ip" function i.e. can i deconstruct an IPAddress object and reconstruct or is there a much easier way to do all this?


Look at the parse example in serial input basics. As written it uses a comma as the delimiter but you can change that.