Skip to main content
Aabc
Associate III
March 4, 2022
Question

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

  • March 4, 2022
  • 2 replies
  • 3328 views

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

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

This topic has been closed for replies.

2 replies

TDK
March 4, 2022

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
AabcAuthor
Associate III
March 6, 2022

Thanks for you