# Question about converting datatypes

**URL:** <https://forum.kirupa.com/t/question-about-converting-datatypes/66279>\
**Category:** Uncategorized\
**Created:** [October 4, 2004, 3:01pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279 "2004-10-04T15:01:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielthelion](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@danielthelion](https://forum.kirupa.com/u/danielthelion)\
**Post date:** [October 4, 2004, 3:01pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/1 "2004-10-04T15:01:29Z")

</div>

hey guys, so im going through ASDG, page by page, and learning everything from scratch. he’s explaining datatypes, i.e. strings, numbers, booleans, arrays, etc…i get that. then he goes into explaining how to convert datatypes from numbers to strings using “toString” , and then strings to numbers using “Number()”…and then later, strings to booleans and stuff. My question is this. could some one please explain to me a situation where someone would want to turn a number into a string or a string into a number?and how would someone even turn a string into a number? i dont understand how that works.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2004, 5:03pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/2 "2004-10-04T17:03:50Z")

</div>

well, i can tell you that in the case of using switch (case) the ability to convert to a number is infinitely useful. like in some programs i have did, you can have a user input 1, 2, 3, or 4 (as a string) and then you can parse that into a number that can used in something like :

```auto

switch (parse)
case 1:
// do this
break;

case 2:
// do this
break;

```

that is one example i have ran across where it is useful. not to say that this would not work with the “parsed” as a string (i have never tried it), but converting it to a number is a good safeguard.

just my $.02.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2004, 5:22pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/3 "2004-10-04T17:22:20Z")

</div>

Maybe (like maximum\_flash said) you make a webpage where you can calculate foreign currenties. The values that comes through POST are strings, so you have to convert them to number to do the calculation.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2004, 5:23pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/4 "2004-10-04T17:23:50Z")

</div>

what does “parse” mean?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2004, 5:48pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/5 "2004-10-04T17:48:53Z")

</div>

parse is a fancy way to say format.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2004, 6:35pm UTC](https://forum.kirupa.com/t/question-about-converting-datatypes/66279/6 "2004-10-04T18:35:27Z")

</div>

i see, well, thats a little more helpful. im still having a hard time wrapping my head around it. can any of you explain what the Number(radix) thing is all about?
