String.civilize
civilize()
Description
Fix obnoxious patterns in a user-submitted string, by applying these filters:
- Convert excess caps to lower-case
- Truncate words over 30 characters long
- Truncate excessive repetition (e.g.
.....
,?????
) - Shrink excess whitespace and newlines
$comment = 'AAAAAAAAAH HELP ME FIX THIS!!!!!!!!!'; $comment.civilize(); //= 'Aaah help me fix this!!'