27
3
The goal of this code-golf is to create a code that lets the user input an ASCII string (contains only printable ASCII characters), and your program outputs the lower-case variant of this string.
Important: you are NOT allowed to use a built-in function that converts the string (or just one character) to lowercase (such as ToLower()
in .NET, strtolower()
in PHP
, ...)! You're allowed to use all other built-in functions, however.
Another important note: The input string doesn't contain only uppercase characters. The input string is a mix of uppercase characters, lowercase characters, numbers and other ASCII printable characters.
Good luck!
4unfortunately, I'll have to opt-out. I'm not a beginner. – John Dvorak – 2013-10-06T13:42:40.390
@Jan: Well, with beginner I actually meant that the skill level of this would be 'beginner', not that only beginners would be allowed to enter. I removed the word 'beginner' and surely, you're allowed to enter. – ProgramFOX – 2013-10-06T13:45:04.603
1Are regular expressions allowed? Only GolfScript could beat
s/./\L\0/g
. – manatwork – 2013-10-06T13:49:59.8803@manatwork: surely
\L
is built in? – marinus – 2013-10-06T13:50:30.260@manatwork: Yes, a regex is allowed. – ProgramFOX – 2013-10-06T13:50:35.480
@marinus is builtin, but not a function. (This would be a function in the regular expression:
s/./lc$&/ge
, so this one clearly not allowed.) – manatwork – 2013-10-06T13:52:19.597@ProgramFOX, can we assume the input will contain only uppercase letters and no other characters? – manatwork – 2013-10-06T14:54:06.043
@manatwork: No, the input will contain uppercase letters, lowercase letters, numbers, and some other ASCII characters. – ProgramFOX – 2013-10-06T15:13:14.927
May the input string contain control characters such as tab, line break, carriage return, or is only the range of ASCII printable characters valid input? What about null bytes, do they have to be replicated in the output?
– FireFly – 2013-10-06T15:44:32.560@FireFly: Only printable characters. I didn't mention that in the question, so it's updated now. – ProgramFOX – 2013-10-06T15:46:22.237