# Breaking a string into separate variables

**URL:** <https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445>\
**Category:** Coding Questions\
**Created:** [June 2, 2021, 3:33pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445 "2021-06-02T15:33:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xysogram](https://avatars.discourse-cdn.com/v4/letter/x/e480ec/32.png) [@xysogram](https://discourse.processing.org/u/xysogram)\
**Post date:** [June 2, 2021, 3:33pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445/1 "2021-06-02T15:33:10Z")

</div>

Hi. Noob question—what is the best way to break a text string (sourced from an imported .csv) into individual variables (new char variable or similar for each character in the string)?

The goal is to input text and convert it into a series of numeric values that can be provided as output.

The steps I am attempting to follow are:  
Load csv with one character per cell  
Create table from csv  
Create variable (char?) for each cell of table  
Convert each cell variable to a numeric (int or float) variable

Currently stuck at step 4 but open to other approaches as well.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 2, 2021, 3:43pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445/2 "2021-06-02T15:43:33Z")

</div>

Hello,

- [int() \ Language (API) \ Processing 3+](https://processing.org/reference/intconvert_.html)
- [float() \ Language (API) \ Processing 3+](https://processing.org/reference/floatconvert_.html)

`:)`

---

<div class="post-metadata">

**Author:** ![xysogram](https://avatars.discourse-cdn.com/v4/letter/x/e480ec/32.png) [@xysogram](https://discourse.processing.org/u/xysogram)\
**Post date:** [June 2, 2021, 3:59pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445/3 "2021-06-02T15:59:42Z")

</div>

Thank you—that is very helpful! I had missed that int() converts to unicode 🙂

This will help with the next stage very much.

The part where I am currently stuck is how to get the data out of the table in the form of a sequence of variables. Right now I am using String / getString to pull the data from each cell of the imported csv but have no way to make variables from that (maybe because I don’t know how or maybe because it is not possible?—I’m not sure).

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 2, 2021, 5:31pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445/4 "2021-06-02T17:31:13Z")

</div>

Hello,

Some stuff that may pique your interest:

- [Data \ Processing.org](https://processing.org/tutorials/data/)
- [Table \ Language (API) \ Processing 3+](https://processing.org/reference/Table.html)
- [split() \ Language (API) \ Processing 3+](https://processing.org/reference/split_.html)

I use the last one when receiving a String of data that is comma separated from the Arduino.

Related:

- _[Serial plotter over bluetooth - #11 by glv](https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378/11)_

`:)`
