use Carp;
 
-our @EXPORT_OK = qw(_hashify camelify snakify);
+our @EXPORT_OK = qw(_hashify camelify snakify trim);
 
 sub _hashify {
   my $keep = shift;
   lc $str;
 }
 
+sub trim {
+  my $value = shift;
+  $value    =~ s{^ \p{WSpace}+ }{}xg if defined($value);
+  $value    =~ s{ \p{WSpace}+ $}{}xg if defined($value);
+  return $value;
+}
+
 1;
 __END__
 
 
 L</camilify> does the reverse.
 
+=item C<trim $string>
+
+Removes all leading and trailing whitespaces from C<$string> and
+returns it. Whitespaces within the string won't be changed.
+
+This function considers everything matching the Unicode character
+property "Whitespace" (C<WSpace>) to be a whitespace.
+
 =back
 
 =head1 BUGS