# Split string into parts

**URL:** <https://forum.arduino.cc/t/split-string-into-parts/998911>\
**Category:** Programming\
**Created:** [June 3, 2022, 9:40am UTC](https://forum.arduino.cc/t/split-string-into-parts/998911 "2022-06-03T09:40:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![red\_car](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@red\_car](https://forum.arduino.cc/u/red_car)\
**Post date:** [June 3, 2022, 9:45am UTC](https://forum.arduino.cc/t/split-string-into-parts/998911/2 "2022-06-03T09:45:02Z")

</div>

> [@How to split a string with space and store the items in array?](https://forum.arduino.cc/t/how-to-split-a-string-with-space-and-store-the-items-in-array/888813/8):
>
> You should be very careful with using the "String" class (especially on AVR based boards) since it uses dynamic memory in a non-transparent way and this may lead to multiple issues, including crashes. Instead of using a string for each of the tokens, you could get the tokens by index: bool get\_token(String &from, String &to, uint8\_t index, char separator) { uint16\_t start = 0, idx = 0; uint8\_t cur = 0; while (idx \< from.length()) { if (from.charAt(idx) == separator) { if (…

Post #9

---

_[View the full topic](https://forum.arduino.cc/t/split-string-into-parts/998911)._
