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.

trim

The trim function is mainly used to remove whitespace from the beginning and end of strings, although it can be used to remove other characters too.

PHP

echo trim("  Hello World  ");
=> // 'Hello World'

Ruby

puts "  Hello World  ".strip
=> # 'Hello World'

The trim() function can also take a second argument which allows the removal of an arbitrary character.

PHP

echo trim("\n\nHello World\n\n", "\n");
=> // 'Hello World'

Ruby

substitute = '\n';
puts "\n\nHello World\n\n".gsub(/^[#{substitute}]+|[#{substitute}]+$/, '')
=> # 'Hello World'
By | 2009-06-12T17:26:40+00:00 June 13th, 2009|Categories: PHP, Ruby|Tags: , , , , , , |Comments Off on trim

About the Author: