|
Posted by lkrubner on 10/26/05 00:07
>>>All the white space got replaced, but the entity that is kill the
>feed
>>is still there.
>>
>>
>>What is wrong with this function?
>>
>>
>> function command($string=false) {
>> $howMany = strlen($string);
>>
>>
>> $newString = "";
>> for ($i=0; $i < $howMany; $i++) {
>> $char = $string[$i];
>> $asciiNum = ord($char);
>> if ($asciiNum > 32 && $asciiNum < 128) {
>> $newString .= $char;
>> } else {
>> $newString .= "'";
>> }
>> }
>>
>>
>> return $newString;
>> }
>
>
> I don't know what's wrong with its operation, but you're
> reinventing the
> wheel.
>
>Have a look at http://uk2.php.net/manual/en/function.strtr.php
I apologize for my ignorance, but I don't see how that reinvents the
wheel. The function you point to would allow me to replace the
offending character if I knew what it was, but I don't know what it
is.That's why I'm walking through the string one character at a time,
checking its ASCII number. Yet even that isn't working. I can't figure
out why. But that's the question.
Navigation:
[Reply to this message]
|