+ 13

Coding Challenge #2: Convert int to string without using any built in functions (My codes included)

Stringify (By:Dao) Create a function that turns an integral numeric argument and turns it into the corresponding string version of itself. You are not allowed to use any built-in function of the language for the conversion. Did it 2 ways. First one used str+num but that would be too easy. So I did the second one using a char array. Do your code in any language and post it here. https://code.sololearn.com/cPL7R4wuIdgn/?ref=app https://code.sololearn.com/cyklaY9FseHE/?ref=app

13th May 2017, 2:02 PM
Pixie
Pixie - avatar
18 ответов
+ 5
I wish there were default parameter values in java, if so 1 line would be enough. https://code.sololearn.com/cS8dhhV1bGZ0/#java
13th May 2017, 2:50 PM
Tamás Barta
Tamás Barta - avatar
+ 9
@pixie there is not any default implementation of toString method in java one has to override it to give its implementation so you can't object use of toString method
13th May 2017, 3:05 PM
Vaibhav Sharma
Vaibhav Sharma - avatar
+ 9
converts any base number, I.e: 1024, 10 -> 1024, FFFF, 16 -> 65535 1010, 2 -> 10
13th May 2017, 5:43 PM
Nikolay Nachev
Nikolay Nachev - avatar
13th May 2017, 5:33 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 8
@Pixie misread the challenge so made this one as well, you can use it for next challenge if you like: https://code.sololearn.com/W6koJ5IRB1C4/#html
13th May 2017, 5:38 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 7
@Tamas I'm a little confused by that code. Function overloading right?Why are the access specifiers different tho? How do you even see a question and formulate a code like this? 😅😂
13th May 2017, 3:01 PM
Pixie
Pixie - avatar
+ 7
But the number of arguments vary, so why override it? I dont really understand the Java concept. (Just saying what I think here 😅)
13th May 2017, 3:07 PM
Pixie
Pixie - avatar
+ 7
Ohhh. Ok I was entering the wrong inputs haha.😂 Thanks @Nikolay 😎
13th May 2017, 5:44 PM
Pixie
Pixie - avatar
+ 6
@Nikolay. Nice 😊
13th May 2017, 5:35 PM
Pixie
Pixie - avatar
+ 6
Also, next challenge has been posted ^_^ https://www.sololearn.com/discuss/387579/?ref=app
13th May 2017, 5:42 PM
Pixie
Pixie - avatar
+ 5
Sorry Pixie, I shouldn't name it toString, as it is a static method it is not the same as Object's toString. I will rename it.
13th May 2017, 3:13 PM
Tamás Barta
Tamás Barta - avatar
+ 5
@nikolay I dont understand what it is 😓 Can you explain what it does?
13th May 2017, 5:41 PM
Pixie
Pixie - avatar
+ 4
I tried in python: https://code.sololearn.com/cT7A9xI9JgNM/?ref=app waiting for replies about my flaws...
14th May 2017, 5:07 PM
Riman Das
Riman Das - avatar
+ 3
@RiMaN: You use built in feature. It it easy in every language, in Java for example: Integer.toString(23)
14th May 2017, 5:09 PM
Tamás Barta
Tamás Barta - avatar
+ 3
@Tamas Barta: is it string formatter or float conversion?
14th May 2017, 5:22 PM
Riman Das
Riman Das - avatar
+ 3
If it's about string formatting, as far as I know it's not a function. besides, integer.toString() is a method (a function indeed).
14th May 2017, 5:57 PM
Riman Das
Riman Das - avatar
0
*** NEW DAILY CHALLENGE *** check it out !!! https://www.sololearn.com/discuss/567313/?ref=app
26th Jul 2017, 11:01 PM
Julian Fechner
Julian Fechner - avatar