use Text::Beautify; $text = "badly written text ,,you know ?" $new_text = beautify($text); # $new_text now holds "Badly written text, you know?" # or $text = Text::Beautify->new("badly written text ,,you know ?"); $new_text = $text->beautify; # and also enable_feature('repeated_punctuation'); # enables the feature disable_feature('trailing_space'); # disables the feature @features_enables = enabled_features(); @all_features = features(); enable_all(); disable_all();
Beautifies text. This involves operations like squeezing double spaces, removing spaces from the beginning and end of lines, upper casing the first character in a string, etc.
You can enable / disable features with enable_feature / disable_feature. These commands return a true value if they are successful.
To know which features are beautified, see FEATURES
All features are enabled by default
Removes heading spaces
Removes trailing spaces
Squeezes double spaces
Squeezes repeated punctuation
Removes spaces in front of punctuation
Puts a spaces after punctuation
Uppercases the first character in the string
Creates a new Text::Beautify object
Applies all the enabled features
Returns a list with the enabled features
Returns a list containing all the features
Enables a feature
Disables a feature
Enables all features
Disables all features
Copyright 2004 Jose Castro, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.