![]() |
How can I capitalize only the first letter in a sentence?
I have some text that goes like this:
whatever goes here whatever goes here too etc and I want to make it look like this: Whatever goes here Whatever goes here too Any ideas? |
php
put the text in a .txt file with one sentence on each line <?php $data = file("filename.txt"); for($i=0;$i<count($data);$i++) { echo UCFirst($data[$i])."<br>\n"; } ?> |
edit:
or how explained above ;) |
<?php
$paragraphs = explode("\n", $text); $new_paragraphs = array(); foreach ($paragraphs as $paragraph => $text) { $ln=0; while ($text{$ln} || $text{$ln}hahahaha' ' || $text{$ln}hahahaha0) { if ($lnhahahaha0) {$new_paragraphs[$paragraph]=strtoupper($text{$ln});} else {$new_paragraphs[$paragraph].=$text{$ln};} } $text=''; foreach ($new_paragraphs as $paragraph => $text) { $text.=$text."\n"; } ?> |
thanks, I'll give a try in a sec
|
hahahaha is 2x =
|
hmmmm
what is the 'hahahaha' ? |
lo you beat me to it
thanks ;) |
Quote:
Thanks again |
no problem :)
|
All times are GMT -7. The time now is 05:04 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123