PHP to Ruby
Convert PHP code into Ruby!
-
ltrim
Posted on June 16th, 2009 No commentsThe ltrim function strips whitespace (or other characters) from the beginning of a string.
PHP
echo ltrim('John and I love icecream', 'John and '); => // 'I love icecream'
Ruby
substitute = 'John and '; puts "John and I love icecream".gsub(/^[#{substitute}]+/, '') => # 'I love icecream'
Leave a reply


