<?php
$text = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было.";
// Для тестов
//$text = "roses are red,and violets are blue.whatever you do i'll keep it for you.";
//$text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
/* Делает первую букву в строке заглавной */
function makeFirstLetterUppercase($text) {
$returnText = "";
"/^\w/u",
"/\.\s*\w/u"
);
$pattern,
function ($matches) {
},
$text
);
return $returnText;
}
/* исправляет текст */
function fixText($text) {
$returnText = "";
$pattern = "/\s*([.,:;!?])\s*/ui";
return $returnText;
}
$text = makeFirstLetterUppercase($text);
$result = fixText($text);
echo "{$result}\n";
?>
PD9waHAKICAgIGVycm9yX3JlcG9ydGluZygtMSk7CiAgICBtYl9pbnRlcm5hbF9lbmNvZGluZygndXRmLTgnKTsKICAgICAKICAgICR0ZXh0ID0gItC90YMg0YfRgtC+LiAgICAgINC90LUg0YHQvNC+0YLRgNC10Lsg0LXRidC1IGJsYWNrIG1lc2Eu0Y8g0YHQvtCx0LjRgNCw0LvRgdGPINGB0LrQsNGH0LDRgtGMICAs0L3QviDQstGB0LUg0LrQsNC6LdGC0L4g0L3QtdC60L7Qs9C00LAg0LHRi9C70L4uIjsKICAgIC8vINCU0LvRjyDRgtC10YHRgtC+0LIKICAgIC8vJHRleHQgPSAicm9zZXMgYXJlIHJlZCxhbmQgdmlvbGV0cyBhcmUgYmx1ZS53aGF0ZXZlciB5b3UgZG8gaSdsbCBrZWVwIGl0IGZvciB5b3UuIjsKICAgIC8vJHRleHQgPSAn0L/RgNC40LLQtdGCLtC10YHRgtGMIDIg0YTRg9C90LrRhtC40LgscHJlZ19zcGxpdCDQuCBleHBsb2RlICzQvdC1INC/0L7QvdC40LzQsNGOLNCyINGH0LXQvCDQvNC10LbQtNGDINC90LjQvNC4INGA0LDQt9C90LjRhtCwLic7CiAgICAgCiAgICAvKiDQlNC10LvQsNC10YIg0L/QtdGA0LLRg9GOINCx0YPQutCy0YMg0LIg0YHRgtGA0L7QutC1INC30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