String::Clean

Use data objects to clean strings
Download

String::Clean Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ben Hengst
  • Publisher web site:
  • http://search.cpan.org/~notbenh/

String::Clean Tags


String::Clean Description

Use data objects to clean strings String::Clean is a Perl module designed to assist in the drudgery of string cleaning by allowing data objects to define what and how to clean.EXAMPLES use String::Clean; my $clean = String::Clean->new(); $clean->replace( { this => 'that', is => 'was' } , 'this is a test' ); # returns 'that was a test' # see the tests for more examples THE OPTIONS HASHEach function can take an optonal hash that will change it's behaviour. This hash can be passed to new and will change the defaults, or you can pass to each call as needed. opt: Any regex options that you want to pass, ie {opt => 'i'} will allow for case insensitive manipulation. replace : If the value is set to 'word' then the replace function will look for words instead of just a collection of charicters. example: replace( { is => 'was' }, 'this is a test', ); returns 'thwas was a test', where replace( { is => 'was' }, 'this is a test', { replace => 'word' }, ); will return 'this was a test' strip : Just like replace, if the value is set to 'word' then strip will look for words instead of just a collection of charicters. word_ boundary : Hook to change what String::Clean will use as the word boundry, by default it will use ''. Mainly this would allow String::Clean to deal with strings like 'this,is,a,test'. escape : If this is set to 'no' then String::Clean will not try to escape any of the things that you've asked it to look for. You can also override options at the function level again, but this happens as merged hash, for example: my $clean = String::Clean->new({replace => 'word', opt => 'i'}); $clean->strip( , 'an Array', {replace =>'non-word'} ); #returns 'n rray' because opt => 'i' was pulled in from the options at new. Requirements: · Perl


String::Clean Related Software