cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert uint8_t and Char arrays to string and int ? How can I use ( .substring(0,7)) function in STM32CubeIDE ?

Aabc
Associate II

How to convert uint8_t and Char arrays to string and int ?

How can I use ( .substring(0,7)) function in STM32CubeIDE ?

2 REPLIES 2
TDK
Guru

You mean C++ string objects?

const char * text = "Hello world";
std::string variable(text);

C++ strings have a substr function, if that's what you mean.

std::string new_variable = variable.substr(0, 7);

Dynamic memory allocation isn't advised on MCUs with limited processing power.

If you feel a post has answered your question, please click "Accept as Solution".
Aabc
Associate II

Thanks for you