# Why cant I display the text of a string made with toString?

**URL:** <https://discourse.processing.org/t/why-cant-i-display-the-text-of-a-string-made-with-tostring/4306>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [October 9, 2018, 10:53pm UTC](https://discourse.processing.org/t/why-cant-i-display-the-text-of-a-string-made-with-tostring/4306 "2018-10-09T22:53:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)\
**Post date:** [October 9, 2018, 10:53pm UTC](https://discourse.processing.org/t/why-cant-i-display-the-text-of-a-string-made-with-tostring/4306/1 "2018-10-09T22:53:03Z")

</div>

got this from the AP-Sync library. building a string that will be sent to Ardu when enter is pressed.

Works great, great library.  
However, I want to also display that string on the java, so I can see what I am typing. println, shows it fine, but “text( toArduino, LS4+190, 70);” said that I cant show that.

I also tried to make a new string just for my text such as: String BeforeSending = toArduino;  
Not allowed, I get a "Type mismatch, “java.lang.StringBuilder” does not match with “java.lang.String”

Here is the function

```auto
  if (keyCode == ENTER){
      println(toArduino + " sent");
     
      streamer.send(toArduino.toString());
      toArduino.setLength(0);
      BeforeSending= "";
  }
  if (keyCode == DELETE || keyCode == BACKSPACE){
      if(toArduino.length() > 0){
         toArduino.deleteCharAt(toArduino.length() - 1);
      }
  }

  if(keyCode != ENTER &&
      keyCode != DELETE &&
      keyCode != ESC &&
      keyCode != UP &&
      keyCode != DOWN &&
      keyCode != BACKSPACE &&
      keyCode != TAB &&
      keyCode != ALT &&
      keyCode != CONTROL &&
      keyCode != RETURN ){

      toArduino.append(key);
  }
}

```

Thanks a lot,  
Mitch

---

<div class="post-metadata">

**Author:** ![Dennis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dennis/32/1111_2.png) [@Dennis](https://discourse.processing.org/u/Dennis)\
**Post date:** [October 10, 2018, 7:16pm UTC](https://discourse.processing.org/t/why-cant-i-display-the-text-of-a-string-made-with-tostring/4306/2 "2018-10-10T19:16:41Z")

</div>

Hi laptophead, the value toArduino it reset as soon as you press “ENTER”

```auto
toArduino.setLength(0);

```

keep the value in another var before .setLength(0)

keep us to date …

---

<div class="post-metadata">

**Author:** ![laptophead](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/laptophead/32/2701_2.png) [@laptophead](https://discourse.processing.org/u/laptophead)\
**Post date:** [October 11, 2018, 1:57am UTC](https://discourse.processing.org/t/why-cant-i-display-the-text-of-a-string-made-with-tostring/4306/3 "2018-10-11T01:57:06Z")

</div>

> [@Dennis](#):
>
> toArduino it reset as soon as you press “ENTER”
> 
> ```auto
> 
> ```

Thanks that worked. Was obvious in retrospect
