<?php
$text = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было." ;
function makeFirstLetterUppercase( $text ) {
$regexp = '/[.!?]/u' ;
$parts = preg_split ( $regexp , $text , 0 , PREG_SPLIT_NO_EMPTY
) ; for ( $i = 0 ; $i < $count ; $i ++ ) {
$trim = ltrim ( $parts [ $i ] ) ; $parts [ $i ] = $first . $second ;
echo "{$parts [$i ]}\n " ;
}
echo $text ;
}
function fixText( $text ) {
$regexp2 = "/[\s]+,|,[\s]+/u" ;
return makeFirstLetterUppercase( $text ) ;
}
$result = fixText( $text ) ;
echo "$result \n " ;
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CiAKJHRleHQgPSAi0L3RgyDRh9GC0L4uICAgICAg0L3QtSDRgdC80L7RgtGA0LXQuyDQtdGJ0LUgYmxhY2sgbWVzYS7RjyDRgdC+0LHQuNGA0LDQu9GB0Y8g0YHQutCw0YfQsNGC0YwgICzQvdC+INCy0YHQtSDQutCw0Lot0YLQviDQvdC10LrQvtCz0LTQsCDQsdGL0LvQvi4iOwpmdW5jdGlvbiBtYWtlRmlyc3RMZXR0ZXJVcHBlcmNhc2UoJHRleHQpIHsKCSRyZWdleHAgPSAnL1suIT9dL3UnOwoJJHBhcnRzID0gcHJlZ19zcGxpdCgkcmVnZXhwLCAkdGV4dCwgMCwgUFJFR19TUExJVF9OT19FTVBUWSk7CgkkY291bnQgPSBjb3VudCgkcGFydHMpOwoJZm9yICgkaSA9IDA7ICRpIDwgJGNvdW50OyAkaSsrKSB7CgkJJHRyaW0gPSBsdHJpbSgkcGFydHNbJGldKTsgCgkJJGZpcnN0ID0gbWJfc3Vic3RyKCR0cmltLCAwLCAxKTsgCgkJJHNlY29uZCA9IG1iX3N1YnN0cigkdHJpbSwgMSk7IAoJCSRmaXJzdCA9IG1iX3N0cnRvdXBwZXIoJGZpcnN0KTsgCgkJJHBhcnRzWyRpXSA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