22

This might sound like a silly question... But I can't find anywhere what the "a" in strconv.Itoa actually stands for. If its taking an integer and turning it into a string, why isn't the function called Itos?

Eric R.
  • 933
  • 1
  • 9
  • 19
  • 9
    it stands for `i`nteger `to` `a`scii: http://stackoverflow.com/questions/2909768/where-did-the-name-atoi-come-from – mvp Apr 04 '13 at 04:51

1 Answers1

41

integer to ASCII. It comes from the C language/UNIX. See this thread for more: Where did the name `atoi` come from?

In the C language, there is no concept such as strings, you have arrays of characters that are null terminated.

Thanks to @mvp!

Community
  • 1
  • 1
X-Istence
  • 16,324
  • 6
  • 57
  • 74
  • Also, it's called `itoa` because the precedent set by C to use that name for this kind of conversion. – Tushar Apr 04 '13 at 04:47
  • Was editing my comment to add that, when I noticed it was tagged Go. Thanks! – X-Istence Apr 04 '13 at 04:49
  • 2
    this is wrong. `A` is coming from `ASCII`, not from array: http://stackoverflow.com/questions/2909768/where-did-the-name-atoi-come-from – mvp Apr 04 '13 at 04:53
  • 1
    The guys who developed Go at Google, also wrote most of Unix and Plan9. So there are many other Unix references littered throughout the documentation. – CyberFonic Apr 04 '13 at 05:31
  • It doesn't really make sense. It's historical baggage that the Go apis have mostly abandoned - but not in this case. Despite UTF8 adoption growing, ASCII is not yet dead, alas. – Rick-777 Apr 04 '13 at 22:39