Extracting part of a String

Hello,

I have two strings as follows:

String abc ="123456789"; //this string always hold numbers

String def; //this one will be converted later to INT

and would like to extract the 1'st 5 characters from string abc and put it in string def for further processing.

So, substring is out of the question because there is no special character I can use for a reference. And can't find a suitable command to do it.

Any help is appreciated.

This will be helpful to you:

Of course you should just use char arrays instead, which can be manipulated in the same way:
https://www.arduino.cc/en/Reference/String
http://www.cplusplus.com/reference/cstdlib/atoi/

Why is substring out of the question?

Pete

It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. Just use cstrings - char arrays terminated with 0.

...R

Array did it for me.

Thanks Pert and all.