How to extract specific data from a string stream

Hello , I'm a bit new to programming . I'm receiving a very long string ie : 74278BDAB64445208

I want to split it into different variables.

For example the 2nd and 3rd digits are stored in a variable called a , the 5th to the 8th is stored in variable called b . Giving me a result of a = 42 , b=8BDA

is there a built-in function which can achieve this in Arduino ? if not can you help me with a way of doing it ?

Many Thanks

me a result of a = 47 , b=8BDA

By my reading, a should contain 42.
Have I misunderstood something?

sorry that was a typo :slight_smile: yes it should be 42

OK, what datatypes are a and b?

A string

I found this function which does the Job .

substring()

In case someone looks for it in the future .

Thanks

You said that you were working on strings, not Strings.
For strings, I would use something like strlcpy.