GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How can I capitalize only the first letter in a sentence? (https://gfy.com/showthread.php?t=464732)

Antonio 05-07-2005 07:20 AM

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?

mortenb 05-07-2005 07:25 AM

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";
}

?>

Bro Media - BANNED FOR LIFE 05-07-2005 07:28 AM

edit:

or how explained above ;)

celebx 05-07-2005 07:29 AM

<?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";
}
?>

Antonio 05-07-2005 07:29 AM

thanks, I'll give a try in a sec

celebx 05-07-2005 07:31 AM

hahahaha is 2x =

Antonio 05-07-2005 07:32 AM

hmmmm

what is the 'hahahaha' ?

Antonio 05-07-2005 07:33 AM

lo you beat me to it
thanks ;)

Antonio 05-07-2005 07:36 AM

Quote:

Originally Posted by mortenb
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";
}

?>

It works,
Thanks again

mortenb 05-07-2005 08:14 AM

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