Mailinglisten-Archive |
Hi andreas,
> Um das abzufangen, dachte ich daran, $info per explode() in einzelne
> Zeilen zu zerlegen und diese jeweils auf wenigstens ein Leerzeichen in
> den ersten 40 Zeichen zu pruefen. Wenn vorhanden wird $info
> akzeptiert.
> Kennt jemand evtl. elegantere Moeglichkeiten?
Wie wärs mit nachfolgender Funktion, die ich mal in ähnlicher Form auf
der ML gefunden hatte:
/* function formatText starts here */
function formatText($strText, $pMax)
{
/** function formatText expects two parameters
* $strText: the text to be formatted
* $pMax: after how many characters $strText should break
*/
$pPos = $pMax;
$intTextLen = strlen($strText);
while ($pPos < $intTextLen)
{
while ($strText[$pPos] != " ") $pPos--;
$strText[$pPos++] = "\n";
$pPos += $pMax;
}
return $strText;
}
/* function formatText ends here */
Liebe Grüsse,
Andreas
--
Andreas Otto
OgilvyInteractive, Aschaffenburger Str. 19
60599 Frankfurt am Main, Germany
Fon: +49 69 60505 151 Fax: +49 69 60505 555
php::bar PHP Wiki - Listenarchive