rtrim

The rtrim function strips whitespace (or other characters) from the end of a string.

PHP

echo rtrim('Work Hard. Play Harder.', ' Play Harder.');
=> // 'Work Hard.'

Ruby

substitute = 'Play Harder.';

puts "Work Hard. Play Harder.".gsub(/[#{substitute}]+$/, '')
=> # 'Work Hard.'
By | 2009-06-18T15:32:19+00:00 June 19th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on rtrim

About the Author:

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.