[wp-hackers] Re: [wp-svn] [5020] trunk/wp-includes: new function: untrailingslashit().

Jamie Talbot wphackers at jamietalbot.com
Sat Mar 10 06:55:22 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

m at wordpress.org wrote:
> +function untrailingslashit($string) {
> +	return preg_replace('|/+$|', '', $string);
> +}
> +

Instead of the overhead of a regular expression, why not use rtrim?

function untrailingslashit($string) {
  return rtrim($string, '/');
}

Cheers,

Jamie.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF8lZZrovxfShShFARAtINAJ9IzkDcN8PO/pmBPlF2NGADmHpg/ACgkHI8
2Fh09te4i7pXYJOlq5OXqOE=
=xOMG
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list