PHP to Ruby
Convert PHP code into Ruby!
-
lcfirst
Posted on July 10th, 2009 2 commentsThe lcfirst() function returns a string, with the first character in lower case - only if the first character is alphabetic.
PHP
echo lcfirst("Java is OK."); => // java is OK.
Ruby
my_string = "Java is OK."; puts my_string[0,1].downcase + my_string[1..-1]; => # java is OK.
-
strtolower
Posted on March 8th, 2009 No commentsReturns the argument provided with all alphabetic characters converted to lowercase.
PHP
echo strtolower('Ruby is pure OO'); // => ruby is pure oo
Ruby
puts 'Ruby is pure OO'.downcase; # => ruby is pure oo


