interesting post. thanks. you should include the logic to make the sentence capitalizer and create a new article
here's another cool way...
PHP Code:
<?
function FixTextCase($text) {
$text = strtolower($text);
$sentences = preg_split("/(\.(\s)?|\?(\s)?)/",$text,-1,PREG_SPLIT_DELIM_CAPTURE);
foreach($sentences as $x) {
if ((trim($x) == ".") || (trim($x) == "?")) {
$outtext .= trim($x)." ";
} else {
$outtext .= ucfirst(trim($x));
}
}
// fix double mark errors
$outtext = preg_replace("/(\s\.)/",".",$outtext);
$outtext = preg_replace("/(\s\?)/","?",$outtext);
return $outtext;
}
$string = "this is a test. IS THIS A TEST? YES it is a test.";
echo FixTextCase($string);
?>