I have something like:
"Hey, this is a title! Come & read me =)))"
it should be regexed to something like:
hey-this-is-a-title-come-read-me
Here is the code for php; may someone help me with perl, please?
public static function getTitleForUrl($title)
{
$title = strval($title); // makes a string
...
$title = strtr(
$title,
'`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\",
' ' . ' '
); // substututes the signs; i dont understand the long empty values.
$title = strtr($title, array('"' => '', "'" => '')); // substitutes all " and ' to nothing
$title = preg_replace('/[ ]+/', '-', trim($title)); // substitutes spaces and trim?
$title = strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); // why not lowerchar?
...
return $title;
}
"Hey, this is a title! Come & read me =)))"
it should be regexed to something like:
hey-this-is-a-title-come-read-me
Here is the code for php; may someone help me with perl, please?
public static function getTitleForUrl($title)
{
$title = strval($title); // makes a string
...
$title = strtr(
$title,
'`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\",
' ' . ' '
); // substututes the signs; i dont understand the long empty values.
$title = strtr($title, array('"' => '', "'" => '')); // substitutes all " and ' to nothing
$title = preg_replace('/[ ]+/', '-', trim($title)); // substitutes spaces and trim?
$title = strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); // why not lowerchar?
...
return $title;
}