Timeline for Converting a string to lower-case (without built-in to-lower functions!)
Current License: CC BY-SA 3.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 20, 2014 at 17:56 | history | edited | Math chiller | CC BY-SA 3.0 |
deleted 10 characters in body
|
Aug 20, 2014 at 10:21 | comment | added | user344 | It's 80 bytes, not 79. | |
Dec 10, 2013 at 12:43 | comment | added | some |
@tryingToGetProgrammingStraight Well, in that case I can write a program that is 0 characters long, pretending that everything else somehow is part of the program. Does that feel fair? Now your code works since it almost a verbatim copy of what I wrote, but you are using $ as a variable name. While it is legal, it is a bit confusing since $ mostly is used by libraries like jQuery. I also noticed that you didn't credit me or anyone else for finding bugs in your code.
|
|
Dec 10, 2013 at 2:52 | comment | added | Math chiller |
@some i figured that maybe it could be part of the program (as in my example), but since u commented i added one with prompt and alert as well, i dont see anything wrong with it now.
|
|
Dec 10, 2013 at 0:24 | comment | added | some |
@tryingToGetProgrammingStraight Somehow you must get the user supplied string into the program, and show the result. When code golfing in javascript the common way is to use prompt and alert . The rules doesn't say anything about it since the rules are language agnostic. If you look at the other answers you will see that they use the equivalent statements to do input/output in their respective languages. So why do you think that you don't need it when writing in javascript?
|
|
Dec 9, 2013 at 21:05 | history | edited | Math chiller | CC BY-SA 3.0 |
added 207 characters in body
|
Dec 9, 2013 at 21:00 | comment | added | Math chiller |
@some there is no rule which requires alert and prompt , but i will edit in that as well
|
|
Dec 9, 2013 at 20:52 | history | edited | Math chiller | CC BY-SA 3.0 |
added 11 characters in body
|
Dec 7, 2013 at 14:36 | comment | added | Ry- |
You need a /g flag for this to work properly.
|
|
Dec 5, 2013 at 13:21 | comment | added | some |
If you had tested your code, you would have fond that it only converts the first upper case character, not all of them. It's 92 characters, when following the rules: alert(prompt().replace(/[A-Z]/g,function(a){return String.fromCharCode(a.charCodeAt()+32)}))
|
|
Oct 7, 2013 at 16:55 | history | edited | Math chiller | CC BY-SA 3.0 |
deleted 12 characters in body
|
Oct 7, 2013 at 14:17 | comment | added | FireFly |
I think all (or at least most) answers in here read from stdin and print to stdout. From what I gather the convention is to use prompt and alert for I/O in JS.
|
|
Oct 7, 2013 at 11:58 | comment | added | Math chiller |
@C5H8NNaO4 three (1)" (2)char (3)" , its already pretty long, and the other answers dont have it. u can test this code if u want to see it run though "TeSt".replace(/[A-Z]/,function($){return String.fromCharCode($.charCodeAt()+32)})
|
|
Oct 7, 2013 at 10:58 | comment | added | C5H8NNaO4 | I guess for a valid input you should at least assume, it, to be predefined. costs only a char | |
Oct 7, 2013 at 10:20 | history | edited | Math chiller | CC BY-SA 3.0 |
added 22 characters in body
|
Oct 7, 2013 at 10:11 | comment | added | Math chiller | @C5H8NNaO4 str(code here) | |
Oct 7, 2013 at 8:37 | comment | added | C5H8NNaO4 | How would i go about running it,like this? | |
Oct 7, 2013 at 8:00 | review | Low quality posts | |||
Oct 7, 2013 at 13:17 | |||||
Oct 7, 2013 at 8:00 | comment | added | FireFly |
Er, you'd need to wrap the second argument to replace with function($){return ...} , no? By the way, the first param to the replacement function is the matched string, so you could drop the parens in the regex.
|
|
Oct 7, 2013 at 7:42 | history | answered | Math chiller | CC BY-SA 3.0 |