# Using \`parseInt\` with a \`stringSplit\` shows difference between device and simulator

**URL:** <https://forum.makecode.com/t/using-parseint-with-a-stringsplit-shows-difference-between-device-and-simulator/1437>\
**Category:** micro:bit\
**Created:** [March 18, 2020, 9:30am UTC](https://forum.makecode.com/t/using-parseint-with-a-stringsplit-shows-difference-between-device-and-simulator/1437 "2020-03-18T09:30:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 18, 2020, 9:30am UTC](https://forum.makecode.com/t/using-parseint-with-a-stringsplit-shows-difference-between-device-and-simulator/1437/1 "2020-03-18T09:30:35Z")

</div>

I filed an issue for this at: [https://github.com/microsoft/pxt-microbit/issues/2664](https://github.com/microsoft/pxt-microbit/issues/2664) but a little confused why this happens:

```auto
let command = "X100\r\n"
let cmdArgs = helpers.stringSplit(command.substr(1, command.length), " ")
serial.writeLine("original: " + cmdArgs[0])
let cmdId = parseInt(cmdArgs[0])
serial.writeLine("parsed: " + cmdId)

```

shows different results between the device and the console simulator. I had some issues with my serial command parser and noticed that `X100 \r\n` made my code work on the device. :-/

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [March 18, 2020, 5:33pm UTC](https://forum.makecode.com/t/using-parseint-with-a-stringsplit-shows-difference-between-device-and-simulator/1437/2 "2020-03-18T17:33:00Z")

</div>

That looks like a bug; thanks for filing an issue!

---

<div class="post-metadata">

**Author:** ![gbraad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gbraad/32/338_2.png) [@gbraad](https://forum.makecode.com/u/gbraad)\
**Post date:** [March 19, 2020, 1:35am UTC](https://forum.makecode.com/t/using-parseint-with-a-stringsplit-shows-difference-between-device-and-simulator/1437/3 "2020-03-19T01:35:00Z")

</div>

what can I do to help debug this?

Somewhere the translation between TypeScript and the machine code needs to happen. Is there a transpiler involved?
