How to concatenate a part of a string and convert then to a int?
There's multiple ways.

The String class (which TBH you should avoid) has some useful methods:


substring - extract part of a string as a new string
toInt - convert a string to an integer


So you can join them together:

int val = myString.substring(3).toInt();


That's the easy way.  Grab the string content from the 4th character (it's zero-based, so 3 is the 4th character) onwards, and convert it to an integer.

If you are avoiding String, as you should, then you are working with pointers.  For instance:

char myString[10]; // This is where your data gets stored
strcpy(myString, "AR0236"); // Let's put in some dummy data

int val = atoi(myString + 3);


myString + 3 gives you a new string pointer to a location that is 3 bytes further up in memory from myString - which equates to where the start of your number is.  Then convert that portion of the string to an integer.

The "easy" way consumes and makes a mess of your heap, since it's having to make a new String object and copy data into it. The "better" (second) way uses no more memory. It just converts a subset of the existing string directly.